Skip to content
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

Instantiate generic ElementType declarations #53943

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

weswigham
Copy link
Member

Fixes #53939

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Apr 20, 2023
@jakebailey
Copy link
Member

@typescript-bot test this
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this faster
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 20, 2023

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at cfd2ae2. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 20, 2023

Heya @jakebailey, I've started to run the tarball bundle task on this PR at cfd2ae2. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 20, 2023

Heya @jakebailey, I've started to run the extended test suite on this PR at cfd2ae2. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 20, 2023

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at cfd2ae2. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 20, 2023

Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at cfd2ae2. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 20, 2023

Heya @jakebailey, I've started to run the abridged perf test suite on this PR at cfd2ae2. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 20, 2023

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/153017/artifacts?artifactName=tgz&fileId=6DC910FB0B486002CE35F1EC7E6D6BE718BDA922A291A8C02DC82747EFA8132302&fileName=/typescript-5.1.0-insiders.20230420.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.1.0-pr-53943-7".;

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparing main and refs/pull/53943/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Package install failed"

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/53943/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.
There were interesting changes:

Main only errors:

Package: preact-i18n
Error:

Error: /home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/DefinitelyTyped/types/preact-i18n/preact-i18n-tests.tsx:12:14
ERROR: 12:14  expect  TypeScript@local compile error: 
'IntlProvider' cannot be used as a JSX component.
  Its type '(props: IntlProviderProps) => Element' is not a valid JSX element type.
    Type '(props: IntlProviderProps) => Element' is not assignable to type 'FunctionComponent<P>'.
      Types of parameters 'props' and 'props' are incompatible.
        Type 'RenderableProps<P, any>' is not assignable to type 'IntlProviderProps'.
          Types of property 'children' are incompatible.
            Type 'ComponentChildren' is not assignable to type 'Element | Element[]'.
              Type 'undefined' is not assignable to type 'Element | Element[]'.
ERROR: 13:18  expect  TypeScript@local compile error: 
'p' cannot be used as a JSX component.
  Its type '"p"' is not a valid JSX element type.
ERROR: 14:22  expect  TypeScript@local compile error: 
'Text' cannot be used as a JSX component.
  Its type '(props: TextProps) => Element' is not a valid JSX element type.
ERROR: 15:22  expect  TypeScript@local compile error: 
'MarkupText' cannot be used as a JSX component.
  Its type '(props: TextProps) => Element' is not a valid JSX element type.
    Type '(props: TextProps) => Element' is not assignable to type 'FunctionComponent<P>'.
      Types of parameters 'props' and 'props' are incompatible.
        Type 'RenderableProps<P, any>' is not assignable to type 'TextProps'.
ERROR: 22:9   expect  TypeScript@local compile error: 
'Example' cannot be used as a JSX component.
  Its type 'typeof Example' is not a valid JSX element type.
    Type 'typeof Example' is not assignable to type 'ComponentClass<P, {}>'.
      Types of parameters 'props' and 'props' are incompatible.
        Type 'P' is not assignable to type 'P | undefined'.
ERROR: 25:31  expect  TypeScript@local compile error: 
'Text' cannot be used as a JSX component.
  Its type '(props: TextProps) => Element' is not a valid JSX element type.
    Type '(props: TextProps) => Element' is not assignable to type 'FunctionComponent<P>'.
      Types of parameters 'props' and 'props' are incompatible.
        Property 'id' is missing in type 'Readonly<Attributes & { children?: ComponentChildren; ref?: Ref<any> | undefined; }>' but required in type 'TextProps'.
ERROR: 26:13  expect  TypeScript@local compile error: 
'span' cannot be used as a JSX component.
  Its type '"span"' is not a valid JSX element type.
ERROR: 30:6   expect  TypeScript@local compile error: 
'IntlProvider' cannot be used as a JSX component.
  Its type '(props: IntlProviderProps) => Element' is not a valid JSX element type.

    at testTypesVersion (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:194:15)
    at async runTests (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:151:9)

Package: preact-virtual-list
Error:

Error: /home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/DefinitelyTyped/types/preact-virtual-list/preact-virtual-list-tests.tsx:10:14
ERROR: 10:14  expect  TypeScript@local compile error: 
'div' cannot be used as a JSX component.
  Its type '"div"' is not a valid JSX element type.
ERROR: 11:18  expect  TypeScript@local compile error: 
'VirtualList' cannot be used as a JSX component.
  Its type 'typeof VirtualList' is not a valid JSX element type.
    Type 'typeof VirtualList' is not assignable to type 'ComponentClass<P, {}>'.
      Types of parameters 'props' and 'props' are incompatible.
        Type 'P' is not assignable to type 'Props'.
ERROR: 13:47  expect  TypeScript@local compile error: 
'div' cannot be used as a JSX component.
  Its type '"div"' is not a valid JSX element type.
ERROR: 24:10  expect  TypeScript@local compile error: 
'div' cannot be used as a JSX component.
  Its type '"div"' is not a valid JSX element type.
ERROR: 25:14  expect  TypeScript@local compile error: 
'VirtualList' cannot be used as a JSX component.
  Its type 'typeof VirtualList' is not a valid JSX element type.
ERROR: 27:43  expect  TypeScript@local compile error: 
'div' cannot be used as a JSX component.
  Its type '"div"' is not a valid JSX element type.

    at testTypesVersion (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:194:15)
    at async runTests (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:151:9)

Package: preact-custom-element
Error:

Error: /home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/DefinitelyTyped/types/preact-custom-element/preact-custom-element-tests.tsx:5:13
ERROR: 5:13   expect  TypeScript@local compile error: 
'div' cannot be used as a JSX component.
  Its type '"div"' is not a valid JSX element type.
ERROR: 14:17  expect  TypeScript@local compile error: 
'div' cannot be used as a JSX component.
  Its type '"div"' is not a valid JSX element type.

    at testTypesVersion (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:194:15)
    at async runTests (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:151:9)

You can check the log here.

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..53943

Metric main 53943 Delta Best Worst p-value
Angular - node (v16.17.1, x64)
Memory used 365,206k (± 0.01%) 365,173k (± 0.00%) ~ 365,149k 365,195k p=0.423 n=6
Parse Time 3.56s (± 0.67%) 3.53s (± 0.34%) ~ 3.52s 3.55s p=0.050 n=6
Bind Time 1.18s (± 0.54%) 1.18s (± 0.64%) ~ 1.17s 1.19s p=0.718 n=6
Check Time 9.56s (± 0.49%) 9.51s (± 0.69%) ~ 9.43s 9.61s p=0.173 n=6
Emit Time 7.94s (± 0.70%) 7.90s (± 0.50%) ~ 7.84s 7.94s p=0.199 n=6
Total Time 22.24s (± 0.49%) 22.13s (± 0.44%) ~ 22.00s 22.25s p=0.128 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 192,618k (± 0.03%) 192,647k (± 0.04%) ~ 192,526k 192,714k p=0.470 n=6
Parse Time 1.60s (± 0.25%) 1.60s (± 1.47%) ~ 1.55s 1.61s p=0.930 n=6
Bind Time 0.83s (± 0.66%) 0.83s (± 0.49%) ~ 0.82s 0.83s p=0.282 n=6
Check Time 10.26s (± 0.52%) 10.22s (± 0.39%) ~ 10.17s 10.27s p=0.259 n=6
Emit Time 2.98s (± 0.69%) 2.99s (± 0.96%) ~ 2.95s 3.03s p=0.870 n=6
Total Time 15.67s (± 0.44%) 15.63s (± 0.50%) ~ 15.54s 15.72s p=0.688 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,788k (± 0.01%) 345,773k (± 0.00%) ~ 345,763k 345,785k p=0.297 n=6
Parse Time 2.72s (± 0.31%) 2.72s (± 0.30%) ~ 2.71s 2.73s p=0.125 n=6
Bind Time 1.09s (± 0.97%) 1.09s (± 0.47%) ~ 1.08s 1.09s p=0.794 n=6
Check Time 7.85s (± 0.51%) 7.84s (± 0.78%) ~ 7.75s 7.91s p=0.936 n=6
Emit Time 4.45s (± 0.97%) 4.43s (± 0.80%) ~ 4.38s 4.48s p=0.747 n=6
Total Time 16.09s (± 0.50%) 16.08s (± 0.52%) ~ 15.95s 16.18s p=0.810 n=6
TFS - node (v16.17.1, x64)
Memory used 300,073k (± 0.01%) 300,077k (± 0.01%) ~ 300,036k 300,118k p=0.873 n=6
Parse Time 2.15s (± 1.00%) 2.15s (± 0.46%) ~ 2.14s 2.16s p=0.805 n=6
Bind Time 1.23s (± 0.84%) 1.24s (± 0.94%) ~ 1.22s 1.25s p=0.456 n=6
Check Time 7.20s (± 0.48%) 7.21s (± 0.32%) ~ 7.18s 7.23s p=0.746 n=6
Emit Time 4.36s (± 0.55%) 4.35s (± 0.49%) ~ 4.32s 4.38s p=0.292 n=6
Total Time 14.95s (± 0.40%) 14.95s (± 0.26%) ~ 14.90s 15.00s p=0.810 n=6
material-ui - node (v16.17.1, x64)
Memory used 481,596k (± 0.01%) 481,569k (± 0.01%) ~ 481,539k 481,609k p=0.128 n=6
Parse Time 3.24s (± 0.42%) 3.25s (± 0.13%) ~ 3.24s 3.25s p=0.528 n=6
Bind Time 0.94s (± 1.24%) 0.94s (± 0.86%) ~ 0.93s 0.95s p=0.315 n=6
Check Time 17.89s (± 0.69%) 17.78s (± 0.61%) ~ 17.69s 17.98s p=0.092 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.07s (± 0.62%) 21.97s (± 0.51%) ~ 21.89s 22.19s p=0.126 n=6
xstate - node (v16.17.1, x64)
Memory used 560,515k (± 0.01%) 560,529k (± 0.01%) ~ 560,488k 560,618k p=0.378 n=6
Parse Time 4.00s (± 0.26%) 4.01s (± 0.69%) ~ 3.97s 4.05s p=0.371 n=6
Bind Time 1.77s (± 0.42%) 1.78s (± 0.29%) ~ 1.77s 1.78s p=0.247 n=6
Check Time 3.03s (± 0.61%) 3.04s (± 0.77%) ~ 3.03s 3.09s p=0.223 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 0.00%) ~ 0.09s 0.09s p=1.000 n=6
Total Time 8.89s (± 0.19%) 8.92s (± 0.43%) ~ 8.88s 8.98s p=0.121 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-135-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • Angular - node (v16.17.1, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Monaco - node (v16.17.1, x64)
  • TFS - node (v16.17.1, x64)
  • material-ui - node (v16.17.1, x64)
  • xstate - node (v16.17.1, x64)
Benchmark Name Iterations
Current 53943 6
Baseline main 6

Developer Information:

Download Benchmark

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions about when the retrieved type is undefined.

@weswigham weswigham merged commit a177af1 into microsoft:main Apr 24, 2023
@weswigham weswigham deleted the generic-element-type branch April 24, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSX.ElementType from #51328 doesn't instantiate defaulted type parameters correctly
5 participants