-
Notifications
You must be signed in to change notification settings - Fork 460
Fix TypedParams #2353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Bashamega
wants to merge
8
commits into
microsoft:main
Choose a base branch
from
Bashamega:rename
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix TypedParams #2353
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
61aa020
Refactor TypedParams
Bashamega 22681a6
Merge branch 'main' into rename
Bashamega f4e6911
Fix interface-mixin MessageEventTarget type parameter
Bashamega 7d5d356
Update src/build/patches.ts
Bashamega bee38a2
Merge branch 'microsoft:main' into rename
Bashamega 8f4512e
Fix build
Bashamega d0efd30
-
Bashamega 5232883
-
Bashamega File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| dictionary ReadableStreamReadDoneResult typeParameters=T { | ||
| dictionary ReadableStreamReadDoneResult typeParameter=T { | ||
| member done required=#true overrideType="true" | ||
| member value required=#true overrideType="T | undefined" | ||
| } | ||
|
|
||
| dictionary ReadableStreamReadValueResult typeParameters=T { | ||
| dictionary ReadableStreamReadValueResult typeParameter=T { | ||
| member done required=#true overrideType="false" | ||
| member value required=#true overrideType="T" | ||
| } | ||
|
|
||
| dictionary UnderlyingSource { | ||
| typeParameters R default=any | ||
| typeParameter R default=any | ||
| member start overrideType="UnderlyingSourceStartCallback<R>" | ||
| member pull overrideType="UnderlyingSourcePullCallback<R>" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,13 +100,9 @@ function handleTypeParameters(value: Value | Node) { | |
| } | ||
| const node = value as Node; | ||
| return { | ||
| typeParameters: [ | ||
| { | ||
| name: string(node.values[0]), | ||
| ...optionalMember("default", "string", node.properties?.default), | ||
| ...optionalMember("extends", "string", node.properties?.extends), | ||
| }, | ||
| ], | ||
| name: string(node.values[0]), | ||
| ...optionalMember("default", "string", node.properties?.default), | ||
| ...optionalMember("extends", "string", node.properties?.extends), | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -207,7 +203,7 @@ function handleMixinAndInterfaces( | |
| const property: Record<string, DeepPartial<Property>> = {}; | ||
| let method: Record<string, DeepPartial<OverridableMethod>> = {}; | ||
| let constructor: DeepPartial<OverridableMethod> | undefined; | ||
| let typeParameters = {}; | ||
| const typeParameters = []; | ||
|
|
||
| for (const child of node.children) { | ||
| switch (child.name) { | ||
|
|
@@ -232,8 +228,8 @@ function handleMixinAndInterfaces( | |
| constructor = merge(constructor, c); | ||
| break; | ||
| } | ||
| case "typeParameters": { | ||
| typeParameters = handleTypeParameters(child); | ||
| case "typeParameter": { | ||
| typeParameters.push(handleTypeParameters(child)); | ||
| break; | ||
| } | ||
| default: | ||
|
|
@@ -242,7 +238,7 @@ function handleMixinAndInterfaces( | |
| } | ||
|
|
||
| const interfaceObject = type === "interface" && { | ||
| ...typeParameters, | ||
| ...optionalNestedMember("typeParameters", typeParameters, typeParameters), | ||
| ...(constructor ? { constructor } : {}), | ||
| ...optionalMember("exposed", "string", node.properties?.exposed), | ||
| ...optionalMember("deprecated", "string", node.properties?.deprecated), | ||
|
|
@@ -270,7 +266,7 @@ function handleMixinAndInterfaces( | |
| "string", | ||
| node.properties?.replaceReference, | ||
| ), | ||
| ...handleTypeParameters(node.properties?.typeParameters), | ||
| ...handleTypeParameters(node.properties?.typeParameter), | ||
|
||
| ...interfaceObject, | ||
| } as DeepPartial<Interface>; | ||
| } | ||
|
|
@@ -396,7 +392,7 @@ function handleMethodAndConstructor( | |
| function handleDictionary(child: Node): DeepPartial<Dictionary> { | ||
| const name = string(child.values[0]); | ||
| const member: Record<string, DeepPartial<Member>> = {}; | ||
| let typeParameters = {}; | ||
| const typeParameters = []; | ||
|
|
||
| for (const c of child.children) { | ||
| switch (c.name) { | ||
|
|
@@ -405,8 +401,8 @@ function handleDictionary(child: Node): DeepPartial<Dictionary> { | |
| member[memberName] = handleMember(c); | ||
| break; | ||
| } | ||
| case "typeParameters": { | ||
| typeParameters = handleTypeParameters(c); | ||
| case "typeParameter": { | ||
| typeParameters.push(handleTypeParameters(c)); | ||
| break; | ||
| } | ||
| default: | ||
|
|
@@ -417,8 +413,8 @@ function handleDictionary(child: Node): DeepPartial<Dictionary> { | |
| return { | ||
| name, | ||
| members: { member }, | ||
| ...typeParameters, | ||
| ...handleTypeParameters(child.properties?.typeParameters), | ||
| ...optionalNestedMember("typeParameters", typeParameters, typeParameters), | ||
| ...handleTypeParameters(child.properties?.typeParameter), | ||
| ...optionalMember( | ||
| "legacyNamespace", | ||
| "string", | ||
|
|
@@ -450,14 +446,14 @@ function handleMember(c: Node): DeepPartial<Member> { | |
| */ | ||
| function handleTypedef(node: Node): DeepPartial<TypeDef> { | ||
| const typeNodes: Node[] = []; | ||
| let typeParameters = {}; | ||
| const typeParameters = []; | ||
| for (const child of node.children) { | ||
| switch (child.name) { | ||
| case "type": | ||
| typeNodes.push(child); | ||
| break; | ||
| case "typeParameters": { | ||
| typeParameters = handleTypeParameters(child); | ||
| case "typeParameter": { | ||
| typeParameters.push(handleTypeParameters(child)); | ||
| break; | ||
| } | ||
| default: | ||
|
|
@@ -475,7 +471,7 @@ function handleTypedef(node: Node): DeepPartial<TypeDef> { | |
| node.properties?.legacyNamespace, | ||
| ), | ||
| ...optionalMember("overrideType", "string", node.properties?.overrideType), | ||
| ...typeParameters, | ||
| ...optionalNestedMember("typeParameters", typeParameters, typeParameters), | ||
| }; | ||
| } | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.