Skip to content

add excess property checks to spread objects defined inline #59277

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
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

iisaduan
Copy link
Member

@iisaduan iisaduan commented Jul 15, 2024

Fixes #39998

This PR adds EPC to a property x from spread objects if

  1. the spread object where x is defined is defined inline
  2. the parent object is part of an HasExpressionInitializer or a return statement
  3. the parent object is not within a JsxOpeningLikeElement

Examples
1- Checks only occur on spreads defined inline. Mostly, this means x is not defined in a variable that is being spread.

    type Foo = { foo: string; }
    const bar = { extraProp: "" };

    const foo: Foo = { extraProp: "", foo: "" }; // EPC error
    const foo2: Foo = { ...bar, foo: "" }; // okay
    const foo3: Foo = { ...{ ...bar}, foo: ""}; // okay
    const foo4: Foo = { ...{ extraProp: "" }, foo: ""}; // EPC error

We now also check conditional spreads if defined inline:

  declare const someCondition: boolean;
  const c: Foo = {
        foo: 1,
        ...(someCondition
            ? {
                excessProperty: 3, // EPC error 
            }
            : {}),
    };

   function f(condition:boolean) { return condition ? { excessProperty: 2 } : {} }

   const d: Foo =  {
        foo: 1,
        ...f(someCondition), // okay
    };

The tests also show that this check works with satisfies.

2-

   type FReturnType = {
        a: any;
    }
    const objWithForbiddenKeys = {  a: 2, c: 2 }

    function f1(): FReturnType {
        return { ...objWithForbiddenKeys } // okay
    }
    function f2(): FReturnType {
        return { ...{ a: 2 }, ...{ c: 2 } }; // EPC error
    }
   
    function f3({a: number}) {
        return;
    }
    f3({  a:2, ...{ c: 2 } }); /// EPC error
    f3({  ...objWithForbiddenKeys }); /// okay

3- This check is blocked when the parent object is within a JSX element. For example, a case that was hit in an earlier iteration of this PR had an error in an object spread and defined within the attributes of a JSX element.

 <Content
        style={{
          ...contentProps.style,
          userSelect: containSelection ? 'text' : undefined,
          // re-namespace exposed content custom properties
          ...{
            '--radix-hover-card-content-transform-origin': 'var(--radix-popper-transform-origin)', // okay
          },
        }}
      />

The reasoning for 2 & 3 stems from previous discussions (for example #29883), that adding more checks in function parameters or jsx props would cause a lot of errors in existing JSX. This was also reflected in the tests for the previous iterations of this PR.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jul 15, 2024
@iisaduan
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 15, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started 👀 Results
user test this ✅ Started 👀 Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

Hey @iisaduan, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the user tests with tsc comparing main and refs/pull/59277/merge:

Something interesting changed - please have a look.

Details

azure-sdk

/mnt/ts_downloads/_/m/azure-sdk/build.sh

  • [NEW] error TS2353: Object literal may only specify known properties, and 'default' does not exist in type 'PackageJson'.
    • /mnt/ts_downloads/_/m/azure-sdk/test/samples/files.spec.ts(55,13)
  • [MISSING] error TS2322: Type 'string' is not assignable to type 'never'.
    • /mnt/ts_downloads/_/m/azure-sdk/test/narrowedTypes.ts(59,9)
    • /mnt/ts_downloads/_/m/azure-sdk/test/narrowedTypes.ts(213,9)
    • /mnt/ts_downloads/_/m/azure-sdk/test/narrowedTypes.ts(254,11)

webpack

tsconfig.types.json

  • [NEW] error TS2353: Object literal may only specify known properties, and 'byDependency' does not exist in type 'Partial<ResolveOptionsResolverFactoryObject_2>'.
  • [NEW] error TS2353: Object literal may only specify known properties, and 'hash' does not exist in type 'ChunkRenderContext'.

tsconfig.json

  • [NEW] error TS2353: Object literal may only specify known properties, and 'byDependency' does not exist in type 'Partial<ResolveOptionsResolverFactoryObject_2>'.
  • [NEW] error TS2353: Object literal may only specify known properties, and 'hash' does not exist in type 'ChunkRenderContext'.

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 193,389k (± 0.98%) 194,040k (± 0.95%) ~ 192,131k 195,823k p=0.689 n=6
Parse Time 1.31s (± 0.93%) 1.30s (± 0.69%) ~ 1.29s 1.31s p=0.362 n=6
Bind Time 0.71s (± 0.58%) 0.71s ~ ~ ~ p=0.405 n=6
Check Time 9.47s (± 0.25%) 9.46s (± 0.29%) ~ 9.42s 9.50s p=0.292 n=6
Emit Time 2.74s (± 1.00%) 2.74s (± 0.76%) ~ 2.71s 2.77s p=0.518 n=6
Total Time 14.23s (± 0.27%) 14.20s (± 0.27%) ~ 14.15s 14.24s p=0.122 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 43 🔻+38 (+760.00%) ~ ~ p=0.001 n=6
Symbols 944,114 944,110 -4 (- 0.00%) ~ ~ p=0.001 n=6
Types 407,050 407,055 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 1,218,361k (± 0.01%) 1,218,624k (± 0.01%) +263k (+ 0.02%) 1,218,541k 1,218,730k p=0.005 n=6
Parse Time 6.69s (± 0.77%) 6.71s (± 1.02%) ~ 6.61s 6.80s p=0.630 n=6
Bind Time 1.87s (± 0.65%) 1.87s (± 0.79%) ~ 1.85s 1.88s p=0.588 n=6
Check Time 30.62s (± 0.49%) 30.80s (± 0.41%) +0.18s (+ 0.59%) 30.62s 30.94s p=0.037 n=6
Emit Time 13.54s (± 0.87%) 13.56s (± 0.54%) ~ 13.49s 13.70s p=1.000 n=6
Total Time 52.72s (± 0.33%) 52.94s (± 0.18%) +0.22s (+ 0.41%) 52.80s 53.08s p=0.025 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 6 🔻+6 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 2,248,864 2,249,815 +951 (+ 0.04%) ~ ~ p=0.001 n=6
Types 937,090 937,167 +77 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,162,676k (± 0.00%) 2,163,039k (± 0.00%) +363k (+ 0.02%) 2,162,999k 2,163,085k p=0.005 n=6
Parse Time 6.60s (± 0.23%) 6.59s (± 0.18%) ~ 6.57s 6.60s p=0.271 n=6
Bind Time 2.33s (± 0.42%) 2.33s (± 0.45%) ~ 2.32s 2.35s p=0.315 n=6
Check Time 71.63s (± 0.61%) 71.41s (± 0.67%) ~ 70.83s 72.06s p=0.471 n=6
Emit Time 0.14s 0.14s (± 2.95%) ~ 0.13s 0.14s p=0.405 n=6
Total Time 80.71s (± 0.54%) 80.47s (± 0.59%) ~ 79.88s 81.12s p=0.378 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 6 🔻+6 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 1,225,948 1,442,135 🔻+216,187 (+17.63%) ~ ~ p=0.001 n=6
Types 261,589 261,843 +254 (+ 0.10%) ~ ~ p=0.001 n=6
Memory used 2,338,580k (± 0.02%) 2,823,117k (± 0.03%) 🔻+484,537k (+20.72%) 2,821,934k 2,824,210k p=0.005 n=6
Parse Time 5.09s (± 1.13%) 7.69s (± 0.37%) 🔻+2.60s (+51.08%) 7.64s 7.72s p=0.005 n=6
Bind Time 1.90s (± 0.73%) 2.96s (± 0.28%) 🔻+1.07s (+56.38%) 2.95s 2.97s p=0.004 n=6
Check Time 34.12s (± 0.10%) 34.19s (± 0.28%) ~ 34.02s 34.27s p=0.108 n=6
Emit Time 3.23s (± 1.08%) 3.24s (± 1.59%) ~ 3.19s 3.34s p=0.419 n=6
Total Time 44.36s (± 0.20%) 48.09s (± 0.26%) 🔻+3.73s (+ 8.42%) 47.89s 48.22s p=0.005 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 6 🔻+6 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 1,225,948 1,442,135 🔻+216,187 (+17.63%) ~ ~ p=0.001 n=6
Types 261,589 261,843 +254 (+ 0.10%) ~ ~ p=0.001 n=6
Memory used 2,413,106k (± 0.03%) 2,911,191k (± 0.02%) 🔻+498,086k (+20.64%) 2,910,585k 2,911,946k p=0.005 n=6
Parse Time 6.34s (± 0.60%) 9.46s (± 0.55%) 🔻+3.11s (+49.07%) 9.40s 9.52s p=0.005 n=6
Bind Time 2.04s (± 0.51%) 3.34s (± 0.33%) 🔻+1.30s (+63.99%) 3.33s 3.36s p=0.004 n=6
Check Time 40.77s (± 0.30%) 40.73s (± 0.21%) ~ 40.61s 40.82s p=0.423 n=6
Emit Time 3.90s (± 1.80%) 3.96s (± 1.76%) ~ 3.88s 4.04s p=0.173 n=6
Total Time 53.05s (± 0.37%) 57.49s (± 0.20%) 🔻+4.44s (+ 8.38%) 57.40s 57.69s p=0.005 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,230 258,230 ~ ~ ~ p=1.000 n=6
Types 104,789 104,789 ~ ~ ~ p=1.000 n=6
Memory used 427,110k (± 0.02%) 427,131k (± 0.03%) ~ 427,014k 427,337k p=0.575 n=6
Parse Time 3.32s (± 0.91%) 3.32s (± 0.85%) ~ 3.28s 3.36s p=1.000 n=6
Bind Time 1.31s (± 1.15%) 1.32s (± 0.88%) ~ 1.30s 1.33s p=0.270 n=6
Check Time 17.79s (± 0.68%) 17.77s (± 0.33%) ~ 17.67s 17.84s p=0.809 n=6
Emit Time 1.64s (± 1.13%) 1.64s (± 0.90%) ~ 1.62s 1.66s p=0.740 n=6
Total Time 24.06s (± 0.56%) 24.05s (± 0.38%) ~ 23.88s 24.15s p=0.748 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,477k (± 0.03%) 369,491k (± 0.03%) ~ 369,363k 369,639k p=0.936 n=6
Parse Time 3.44s (± 1.26%) 3.44s (± 0.65%) ~ 3.41s 3.47s p=0.870 n=6
Bind Time 1.94s (± 1.32%) 1.93s (± 0.91%) ~ 1.92s 1.96s p=0.935 n=6
Check Time 19.14s (± 0.18%) 19.11s (± 0.31%) ~ 19.03s 19.19s p=0.334 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.52s (± 0.24%) 24.50s (± 0.25%) ~ 24.39s 24.56s p=0.575 n=6
vscode - node (v18.15.0, x64)
Errors 0 57 🔻+57 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 2,891,160 2,892,215 +1,055 (+ 0.04%) ~ ~ p=0.001 n=6
Types 978,184 978,806 +622 (+ 0.06%) ~ ~ p=0.001 n=6
Memory used 3,054,960k (± 0.00%) 3,056,247k (± 0.00%) +1,287k (+ 0.04%) 3,056,165k 3,056,330k p=0.005 n=6
Parse Time 16.91s (± 0.19%) 16.91s (± 0.34%) ~ 16.81s 16.98s p=1.000 n=6
Bind Time 5.11s (± 0.26%) 5.13s (± 0.24%) ~ 5.11s 5.14s p=0.154 n=6
Check Time 89.57s (± 0.43%) 90.84s (± 0.34%) +1.27s (+ 1.42%) 90.36s 91.19s p=0.005 n=6
Emit Time 29.22s (± 0.62%) 29.19s (± 0.90%) ~ 28.94s 29.61s p=0.575 n=6
Total Time 140.81s (± 0.31%) 142.05s (± 0.27%) +1.24s (+ 0.88%) 141.58s 142.66s p=0.005 n=6
webpack - node (v18.15.0, x64)
Errors 0 2 🔻+2 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 267,239 267,137 -102 (- 0.04%) ~ ~ p=0.001 n=6
Types 108,815 108,809 -6 (- 0.01%) ~ ~ p=0.001 n=6
Memory used 411,812k (± 0.02%) 411,962k (± 0.02%) +151k (+ 0.04%) 411,870k 412,116k p=0.031 n=6
Parse Time 3.83s (± 0.56%) 3.81s (± 0.52%) ~ 3.79s 3.84s p=0.122 n=6
Bind Time 1.69s (± 0.69%) 1.69s (± 0.24%) ~ 1.68s 1.69s p=0.858 n=6
Check Time 16.73s (± 0.27%) 16.73s (± 0.33%) ~ 16.63s 16.78s p=1.000 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.25s (± 0.19%) 22.23s (± 0.28%) ~ 22.12s 22.29s p=0.748 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 1 🔻+1 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 510,479 510,479 ~ ~ ~ p=1.000 n=6
Types 161,600 161,600 ~ ~ ~ p=1.000 n=6
Memory used 448,226k (± 0.04%) 447,923k (± 0.10%) ~ 447,578k 448,555k p=0.298 n=6
Parse Time 3.90s (± 0.66%) 3.89s (± 0.50%) ~ 3.87s 3.92s p=0.292 n=6
Bind Time 1.46s (± 1.47%) 1.45s (± 0.71%) ~ 1.44s 1.47s p=0.326 n=6
Check Time 21.06s (± 0.23%) 21.15s (± 0.53%) ~ 21.02s 21.31s p=0.146 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 26.43s (± 0.33%) 26.50s (± 0.46%) ~ 26.34s 26.65s p=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the top 400 repos with tsc comparing main and refs/pull/59277/merge:

Something interesting changed - please have a look.

Details

apollographql/apollo-client

2 of 12 projects failed to build with the old tsc and were ignored

tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'method' does not exist in type '{ headers: Record<string, any>; body?: string | undefined; }'.

ChatGPTNextWeb/ChatGPT-Next-Web

tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'max_tokens' does not exist in type 'LLMConfig'.
  • error TS2353: Object literal may only specify known properties, and 'sendMemory' does not exist in type 'LLMConfig'.

cheeriojs/cheerio

1 of 3 projects failed to build with the old tsc and were ignored

tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'xml' does not exist in type 'InternalOptions'.

Chocobozzz/PeerTube

6 of 12 projects failed to build with the old tsc and were ignored

packages/types-generator/tsconfig.types.json

packages/tests/tsconfig.json

continuedev/continue

extensions/vscode/tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'env' does not exist in type 'Config'.
  • error TS2353: Object literal may only specify known properties, and 'log' does not exist in type 'CompletionOptions'.
  • error TS2353: Object literal may only specify known properties, and 'provider' does not exist in type 'LLMOptions'.

core/tsconfig.npm.json

  • error TS2353: Object literal may only specify known properties, and 'env' does not exist in type 'Config'.
  • error TS2353: Object literal may only specify known properties, and 'log' does not exist in type 'CompletionOptions'.
  • error TS2353: Object literal may only specify known properties, and 'provider' does not exist in type 'LLMOptions'.

core/tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'env' does not exist in type 'Config'.
  • error TS2353: Object literal may only specify known properties, and 'log' does not exist in type 'CompletionOptions'.
  • error TS2353: Object literal may only specify known properties, and 'provider' does not exist in type 'LLMOptions'.

binary/tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'env' does not exist in type 'Config'.
  • error TS2353: Object literal may only specify known properties, and 'log' does not exist in type 'CompletionOptions'.
  • error TS2353: Object literal may only specify known properties, and 'provider' does not exist in type 'LLMOptions'.

gui/tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'env' does not exist in type 'Config'.
  • error TS2353: Object literal may only specify known properties, and 'provider' does not exist in type 'LLMOptions'.

conwnet/github1s

extensions/github1s/tsconfig.json

desktop/desktop

1 of 4 projects failed to build with the old tsc and were ignored

tsconfig.json

discordjs/discord.js

39 of 62 projects failed to build with the old tsc and were ignored

packages/voice/tsconfig.json

packages/voice/tsconfig.eslint.json

packages/voice/tsconfig.docs.json

packages/api-extractor-model/tsconfig.json

packages/api-extractor-model/tsconfig.eslint.json

dubinc/dub

2 of 4 projects failed to build with the old tsc and were ignored

packages/utils/tsconfig.json

FaridSafi/react-native-gifted-chat

1 of 2 projects failed to build with the old tsc and were ignored

tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'isTyping' does not exist in type 'Readonly<MessageProps<IMessage>> & Readonly<{ children?: ReactNode; }>'.

google/blockly

2 of 3 projects failed to build with the old tsc and were ignored

tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'deletable' does not exist in type 'FlyoutItemInfo'.
  • error TS2353: Object literal may only specify known properties, and 'deletable' does not exist in type 'BlockInfo'.

graphile/crystal

5 of 11 projects failed to build with the old tsc and were ignored

tsconfig.json

immich-app/immich

2 of 7 projects failed to build with the old tsc and were ignored

server/tsconfig.json

server/tsconfig.build.json

Infisical/infisical

1 of 2 projects failed to build with the old tsc and were ignored

backend/tsconfig.json

inversify/InversifyJS

2 of 5 projects failed to build with the old tsc and were ignored

src/tsconfig-es6.json

  • error TS2353: Object literal may only specify known properties, and 'isAsync' does not exist in type 'CreateInstanceWithInjectionArg<T>'.

src/tsconfig-es.json

  • error TS2353: Object literal may only specify known properties, and 'isAsync' does not exist in type 'CreateInstanceWithInjectionArg<T>'.

src/tsconfig-amd.json

  • error TS2353: Object literal may only specify known properties, and 'isAsync' does not exist in type 'CreateInstanceWithInjectionArg<T>'.

invoke-ai/InvokeAI

invokeai/frontend/web/tsconfig.json

jhipster/generator-jhipster

tsconfig.types.json

tsconfig.spec.json

tsconfig.json

@typescript-bot
Copy link
Collaborator

@iisaduan Here are some more interesting changes from running the top 400 repos suite

Details

jupyterlab/jupyterlab

46 of 59 projects failed to build with the old tsc and were ignored

packages/ui-components/examples/simple-windowed-list/tsconfig.json

@typescript-bot
Copy link
Collaborator

@iisaduan Here are some more interesting changes from running the top 400 repos suite

Details

labring/FastGPT

1 of 8 projects failed to build with the old tsc and were ignored

projects/app/tsconfig.json

  • error TS2322: Type '{ children: string; cursor: "default"; color: "myGray.700"; fontWeight: "bold"; fontSize: string[]; py: number; px: number; borderRadius: "md"; } | { children: string; cursor: "pointer"; color: "myGray.500"; ... 5 more ...; borderRadius: "md"; }' is not assignable to type 'IntrinsicAttributes & Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "p" | ... 418 more ... | "css"> & { ...; } & Omit<...> & { ...; }'.
  • error TS2353: Object literal may only specify known properties, and 'type' does not exist in type 'FlowNodeInputItemType'.
  • error TS2353: Object literal may only specify known properties, and 'position' does not exist in type 'FlowNodeItemType'.

labring/sealos

17 of 20 projects failed to build with the old tsc and were ignored

frontend/packages/client-sdk/tsconfig.json

lyswhut/lx-music-desktop

1 of 6 projects failed to build with the old tsc and were ignored

src/renderer/tsconfig.json

microsoft/vscode

4 of 53 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

src/tsconfig.monaco.json

src/tsconfig.json

nextui-org/nextui

2 of 80 projects failed to build with the old tsc and were ignored

packages/hooks/use-aria-multiselect/tsconfig.json

packages/hooks/use-aria-menu/tsconfig.json

packages/core/react/tsconfig.json

packages/components/select/tsconfig.json

packages/components/menu/tsconfig.json

packages/components/dropdown/tsconfig.json

noodle-run/noodle

tsconfig.json

  • error TS2322: Type '{ creator: string; card?: "summary_large_image"; images?: string[]; title: string; description: string; }' is not assignable to type 'Twitter | null'.

omnivore-app/omnivore

5 of 21 projects failed to build with the old tsc and were ignored

packages/text-to-speech/tsconfig.json

pnpm/pnpm

154 of 258 projects failed to build with the old tsc and were ignored

pkg-manager/core/test/tsconfig.json

portainer/portainer

tsconfig.json

  • error TS2345: Argument of type '{ EdgeSettings?: EdgeTemplateSettings | { SupportRelativePath: boolean; FilesystemPath: string; SupportPerDeviceConfigs: boolean; PerDeviceConfigsPath: string; ... 6 more ...; StaggerConfig: StaggerConfig; } | undefined; ... 23 more ...; Logo: string; }' is not assignable to parameter of type 'CustomTemplateFromGitRepositoryPayload'.

radix-ui/primitives

1 of 3 projects failed to build with the old tsc and were ignored

ssr-testing/tsconfig.json

recharts/recharts

1 of 4 projects failed to build with the old tsc and were ignored

tsconfig.json

storybook/tsconfig.json

demo/tsconfig.json

reduxjs/redux-devtools

25 of 58 projects failed to build with the old tsc and were ignored

extension/tsconfig.json

supabase/supabase

31 of 37 projects failed to build with the old tsc and were ignored

apps/studio/tsconfig.json

tailwindlabs/headlessui

1 of 5 projects failed to build with the old tsc and were ignored

packages/@headlessui-react/tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'style' does not exist in type '{ as?: ElementType | undefined; children?: ReactNode | ((bag: {}) => ReactElement<any, string | JSXElementConstructor<any>>); refName?: string | undefined; className?: any; static?: boolean | undefined; unmount?: boolean | undefined; } & { ...; }'.

TanStack/query

80 of 90 projects failed to build with the old tsc and were ignored

packages/query-core/tsconfig.legacy.json

packages/query-core/tsconfig.json

tinacms/tinacms

12 of 24 projects failed to build with the old tsc and were ignored

packages/@tinacms/schema-tools/tsconfig.json

packages/@tinacms/graphql/tsconfig.json

  • error TS2322: Type '{ list: true; ui?: UIField<string, true> & ObjectUiProps & { itemProps?(item: Record<string, any>): { key?: string; label?: string | boolean; }; defaultItem?: DefaultItem<...>; previewSrc?: string; }; ... 11 more ...; namespace: string[]; } | { ...; }' is not assignable to type 'Collectable'.
  • error TS2322: Type '{ list: true; ui?: UIField<string, true> & ObjectUiProps & { itemProps?(item: Record<string, any>): { key?: string; label?: string | boolean; }; defaultItem?: DefaultItem<...>; previewSrc?: string; }; ... 11 more ...; namespace: string[]; } | { ...; } | { ...; } | { ...; }' is not assignable to type 'Collectable'.
  • error TS2353: Object literal may only specify known properties, and 'templates' does not exist in type 'Template<true>'.

trpc/trpc

29 of 36 projects failed to build with the old tsc and were ignored

packages/server/tsconfig.json

packages/server/tsconfig.benchmark.json

packages/react-query/tsconfig.json

packages/next/tsconfig.watch.json

packages/next/tsconfig.json

packages/client/tsconfig.json

withfig/autocomplete

tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'subcommands' does not exist in type 'Suggestion'.

@iisaduan iisaduan mentioned this pull request Jul 15, 2024
@iisaduan
Copy link
Member Author

@typescript-bot test top400
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 17, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started 👀 Results
user test this ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the user tests with tsc comparing main and refs/pull/59277/merge:

Something interesting changed - please have a look.

Details

azure-sdk

/mnt/ts_downloads/_/m/azure-sdk/build.sh

  • [NEW] error TS2353: Object literal may only specify known properties, and 'loggingOptions' does not exist in type 'GeneratedClientOptionalParams'.
    • /mnt/ts_downloads/_/m/azure-sdk/src/hubClient.ts(373,9)

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the top 400 repos with tsc comparing main and refs/pull/59277/merge:

Something interesting changed - please have a look.

Details

dubinc/dub

2 of 4 projects failed to build with the old tsc and were ignored

packages/utils/tsconfig.json

FaridSafi/react-native-gifted-chat

1 of 2 projects failed to build with the old tsc and were ignored

tsconfig.json

labring/FastGPT

1 of 8 projects failed to build with the old tsc and were ignored

projects/app/tsconfig.json

packages/service/tsconfig.json

microsoft/vscode

4 of 53 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

src/tsconfig.json

mui/material-ui

23 of 81 projects failed to build with the old tsc and were ignored

test/tsconfig.json

packages/mui-joy/tsconfig.json

docs/tsconfig.json

packages/mui-joy/tsconfig.build.json

noodle-run/noodle

tsconfig.json

  • error TS2322: Type '{ creator: string; card?: "summary_large_image"; images?: string[]; title: string; description: string; }' is not assignable to type 'Twitter | null'.

radix-ui/primitives

1 of 3 projects failed to build with the old tsc and were ignored

ssr-testing/tsconfig.json

react-bootstrap/react-bootstrap

1 of 3 projects failed to build with the old tsc and were ignored

tsconfig.json

  • error TS2353: Object literal may only specify known properties, and ''--bs-aspect-ratio'' does not exist in type 'Properties<string | number, string & {}>'.

test/tsconfig.json

  • error TS2353: Object literal may only specify known properties, and ''--bs-aspect-ratio'' does not exist in type 'Properties<string | number, string & {}>'.

tailwindlabs/headlessui

1 of 5 projects failed to build with the old tsc and were ignored

packages/@headlessui-react/tsconfig.json

  • error TS2353: Object literal may only specify known properties, and 'hidden' does not exist in type 'CleanProps<ElementType, never> & OurProps<ElementType, TSlot> & { className?: any; } & { ref?: unknown; }'.

@iisaduan iisaduan changed the title add more excess property checks add excess property checks to spread objects defined inline Jul 18, 2024
@iisaduan
Copy link
Member Author

iisaduan commented Jul 19, 2024

User Test analysis

azure-sdk

error TS2353: Object literal may only specify known properties, and 'loggingOptions' does not exist in type 'GeneratedClientOptionalParams'.

This might be a param that was not generated correctly. It might be the case that defining apiVersion and loggingOptions in an inline spread as opposed to just defining them in the object itself is to avoid EPC.

import { GeneratedClientOptionalParams } from './generated';
const internalPipelineOptions: GeneratedClientOptionalParams = {
    ...this.clientOptions,
    ...{
      apiVersion: this.apiVersion,
      loggingOptions: {
        additionalAllowedHeaderNames: this.clientOptions?.loggingOptions?.additionalAllowedHeaderNames,
        additionalAllowedQueryParameters: this.clientOptions?.loggingOptions?.additionalAllowedQueryParameters,
        logger: logger.info,
      },
    },
    ...(isTokenCredential(this.credential)
      ? {
          credential: this.credential,
          credentialScopes: ["https://webpubsub.azure.com/.default"],
        }
      : {}),
};

@iisaduan
Copy link
Member Author

iisaduan commented Jul 19, 2024

Top 400 analysis

dubinc/dub and noodle-run/noodle

These are errors on the same twitter: Twitter | null property. Both of the object literal properties here had other EPC errors already, so we are erroring on a different excess property (5.5.3 playground)

FaridSafi/react-native-gifted-chat

This is on an element in style nested in a jsx props.

function Composer(): React.ReactElement {
return (
    <TextInput
      style={[
        styles.textInput,
        textInputStyle,
        { // error
          height: composerHeight,
          ...Platform.select({
            web: {
              outlineWidth: 0,
              outlineColor: 'transparent',
              outlineOffset: 0,
            },
          }),
        },
      ]}

      {...textInputProps}
    />
  )
}

labring/FastGPT

excess property on the value a record object called properties (playground with simplified case)

vscode

Excess properties in types used for options:

  • selection is an excess property in a conditional spread (link)
  • two occurrences of excess property startIn, one of which is spread by itself { ...{startIn} } (link) (link2)
  • error TS2769: No overload matches this call: This error is caused by EPC causing the function call to no longer type check in a way that matches an overload signature. The excess property here is also a startIn spread by itself into an destructured function param object. (link)

radix-ui/primatives

Each of these are in style of a jsx props and they are all tagged with // re-namespace exposed content custom properties.

react-bootstrap/react-bootstrap

Excess property in a style prop.

headlessui

Excess property an object that is a function param, and the function uses the object as props in a jsx element.

@iisaduan iisaduan marked this pull request as ready for review July 19, 2024 08:19
@iisaduan
Copy link
Member Author

iisaduan commented Jul 19, 2024

Changed some behavior (specifically: decided on points 2 and 3 in the PR description) based on the test results above.

@typescript-bot test top400
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 19, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started 👀 Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

Hey @iisaduan, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the user tests with tsc comparing main and refs/pull/59277/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 194,116k (± 0.98%) 192,868k (± 0.75%) ~ 192,232k 195,841k p=0.261 n=6
Parse Time 1.58s (± 1.06%) 1.57s (± 1.32%) ~ 1.54s 1.59s p=0.934 n=6
Bind Time 0.86s (± 1.47%) 0.85s (± 1.42%) ~ 0.84s 0.87s p=0.458 n=6
Check Time 11.32s (± 0.49%) 11.30s (± 0.62%) ~ 11.18s 11.38s p=0.809 n=6
Emit Time 3.28s (± 0.59%) 3.27s (± 0.92%) ~ 3.22s 3.31s p=0.871 n=6
Total Time 17.04s (± 0.36%) 17.00s (± 0.47%) ~ 16.91s 17.11s p=0.422 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,250 944,250 ~ ~ ~ p=1.000 n=6
Types 407,076 407,076 ~ ~ ~ p=1.000 n=6
Memory used 1,218,685k (± 0.00%) 1,218,722k (± 0.00%) ~ 1,218,676k 1,218,793k p=0.297 n=6
Parse Time 8.00s (± 0.58%) 8.01s (± 0.67%) ~ 7.94s 8.09s p=0.810 n=6
Bind Time 2.22s (± 0.57%) 2.22s (± 0.37%) ~ 2.22s 2.24s p=0.437 n=6
Check Time 36.24s (± 0.45%) 36.44s (± 0.52%) ~ 36.24s 36.72s p=0.149 n=6
Emit Time 17.95s (± 1.11%) 17.85s (± 0.22%) ~ 17.81s 17.90s p=0.748 n=6
Total Time 64.42s (± 0.46%) 64.53s (± 0.33%) ~ 64.31s 64.85s p=0.378 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,276,156 2,276,156 ~ ~ ~ p=1.000 n=6
Types 948,845 948,844 -1 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,207,629k (± 0.00%) 2,207,623k (± 0.00%) ~ 2,207,549k 2,207,692k p=0.471 n=6
Parse Time 9.70s (± 0.08%) 9.69s (± 0.33%) ~ 9.65s 9.73s p=0.744 n=6
Bind Time 3.39s (± 1.19%) 3.37s (± 0.46%) ~ 3.35s 3.39s p=0.625 n=6
Check Time 106.10s (± 0.37%) 105.96s (± 0.19%) ~ 105.59s 106.15s p=0.689 n=6
Emit Time 0.21s (± 2.50%) 0.20s (± 2.62%) 🟩-0.01s (- 4.84%) 0.19s 0.20s p=0.018 n=6
Total Time 119.39s (± 0.30%) 119.22s (± 0.19%) ~ 118.80s 119.46s p=0.688 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,332 1,227,344 +12 (+ 0.00%) ~ ~ p=0.001 n=6
Types 261,851 261,859 +8 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,342,642k (± 0.02%) 2,342,422k (± 0.02%) ~ 2,341,918k 2,343,326k p=0.471 n=6
Parse Time 7.52s (± 0.55%) 7.52s (± 0.57%) ~ 7.48s 7.57s p=1.000 n=6
Bind Time 2.78s (± 0.60%) 2.78s (± 0.59%) ~ 2.76s 2.80s p=0.936 n=6
Check Time 49.85s (± 0.50%) 49.92s (± 0.48%) ~ 49.58s 50.19s p=0.575 n=6
Emit Time 4.75s (± 0.76%) 4.75s (± 1.34%) ~ 4.63s 4.80s p=0.575 n=6
Total Time 64.90s (± 0.40%) 64.99s (± 0.34%) ~ 64.67s 65.29s p=0.689 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,332 1,227,344 +12 (+ 0.00%) ~ ~ p=0.001 n=6
Types 261,851 261,859 +8 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,415,736k (± 0.03%) 2,534,358k (±11.39%) ~ 2,415,859k 3,123,930k p=0.093 n=6
Parse Time 6.29s (± 0.81%) 6.32s (± 0.68%) ~ 6.29s 6.39s p=0.173 n=6
Bind Time 2.04s (± 0.84%) 2.04s (± 1.03%) ~ 2.00s 2.06s p=0.869 n=6
Check Time 41.10s (± 0.30%) 41.08s (± 0.66%) ~ 40.87s 41.51s p=0.521 n=6
Emit Time 3.96s (± 2.06%) 3.94s (± 1.19%) ~ 3.88s 4.01s p=0.748 n=6
Total Time 53.41s (± 0.16%) 53.39s (± 0.51%) ~ 53.18s 53.81s p=0.378 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,516 258,528 +12 (+ 0.00%) ~ ~ p=0.001 n=6
Types 104,901 104,909 +8 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 427,906k (± 0.02%) 427,879k (± 0.03%) ~ 427,742k 428,070k p=0.471 n=6
Parse Time 4.16s (± 0.35%) 4.16s (± 0.49%) ~ 4.12s 4.18s p=0.732 n=6
Bind Time 1.63s (± 0.81%) 1.64s (± 1.00%) ~ 1.61s 1.65s p=0.623 n=6
Check Time 22.23s (± 0.38%) 22.19s (± 0.11%) ~ 22.16s 22.23s p=0.422 n=6
Emit Time 2.00s (± 0.61%) 2.01s (± 0.37%) ~ 2.00s 2.02s p=0.111 n=6
Total Time 30.03s (± 0.33%) 30.00s (± 0.05%) ~ 29.98s 30.02s p=0.747 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,685k (± 0.03%) 369,591k (± 0.02%) ~ 369,524k 369,686k p=0.199 n=6
Parse Time 3.44s (± 0.56%) 3.43s (± 1.09%) ~ 3.39s 3.48s p=0.573 n=6
Bind Time 1.93s (± 0.78%) 1.93s (± 1.69%) ~ 1.88s 1.97s p=0.681 n=6
Check Time 19.29s (± 0.38%) 19.27s (± 0.22%) ~ 19.20s 19.31s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.66s (± 0.23%) 24.63s (± 0.16%) ~ 24.56s 24.67s p=0.422 n=6
vscode - node (v18.15.0, x64)
Errors 0 1 🔻+1 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 2,973,349 2,973,355 +6 (+ 0.00%) ~ ~ p=0.001 n=6
Types 1,021,157 1,021,169 +12 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 3,097,764k (± 0.00%) 3,097,931k (± 0.00%) +167k (+ 0.01%) 3,097,893k 3,097,974k p=0.005 n=6
Parse Time 17.14s (± 0.35%) 17.14s (± 0.28%) ~ 17.09s 17.20s p=0.744 n=6
Bind Time 5.31s (± 1.91%) 5.22s (± 1.86%) -0.09s (- 1.69%) 5.18s 5.42s p=0.050 n=6
Check Time 96.12s (± 0.46%) 96.60s (± 0.28%) +0.49s (+ 0.51%) 96.31s 97.02s p=0.045 n=6
Emit Time 24.88s (± 0.39%) 25.01s (± 0.84%) ~ 24.65s 25.23s p=0.173 n=6
Total Time 143.44s (± 0.25%) 143.98s (± 0.30%) ~ 143.37s 144.64s p=0.092 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,370 267,370 ~ ~ ~ p=1.000 n=6
Types 108,862 108,862 ~ ~ ~ p=1.000 n=6
Memory used 411,943k (± 0.02%) 411,899k (± 0.01%) ~ 411,859k 411,971k p=0.297 n=6
Parse Time 3.86s (± 0.52%) 3.85s (± 0.50%) ~ 3.82s 3.87s p=0.418 n=6
Bind Time 1.68s (± 0.62%) 1.70s (± 0.72%) ~ 1.68s 1.71s p=0.183 n=6
Check Time 16.89s (± 0.52%) 16.89s (± 0.24%) ~ 16.83s 16.95s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.43s (± 0.45%) 22.44s (± 0.17%) ~ 22.40s 22.51s p=0.936 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 510,573 510,573 ~ ~ ~ p=1.000 n=6
Types 161,621 161,621 ~ ~ ~ p=1.000 n=6
Memory used 448,393k (± 0.07%) 448,379k (± 0.07%) ~ 447,780k 448,583k p=0.936 n=6
Parse Time 2.62s (± 0.79%) 2.64s (± 0.78%) ~ 2.61s 2.65s p=0.211 n=6
Bind Time 0.98s 0.98s (± 0.77%) ~ 0.97s 0.99s p=0.598 n=6
Check Time 14.53s (± 0.19%) 14.56s (± 0.33%) ~ 14.49s 14.61s p=0.261 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 18.13s (± 0.18%) 18.18s (± 0.21%) +0.05s (+ 0.28%) 18.13s 18.23s p=0.043 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,306ms (± 0.13%) 2,295ms (± 0.55%) ~ 2,274ms 2,312ms p=0.065 n=6
Req 2 - geterr 5,157ms (± 0.27%) 5,160ms (± 0.40%) ~ 5,138ms 5,188ms p=0.936 n=6
Req 3 - references 263ms (± 0.81%) 260ms (± 0.31%) -3ms (- 1.20%) 259ms 261ms p=0.033 n=6
Req 4 - navto 227ms (± 0.33%) 229ms (± 0.94%) ~ 225ms 231ms p=0.059 n=6
Req 5 - completionInfo count 1,357 1,357 ~ ~ ~ p=1.000 n=6
Req 5 - completionInfo 89ms (± 3.88%) 88ms (± 5.16%) ~ 85ms 97ms p=0.514 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,431ms (± 1.13%) 2,403ms (± 0.97%) ~ 2,381ms 2,446ms p=0.066 n=6
Req 2 - geterr 3,873ms (± 0.38%) 3,875ms (± 0.38%) ~ 3,861ms 3,902ms p=1.000 n=6
Req 3 - references 276ms (± 1.32%) 272ms (± 0.54%) -4ms (- 1.45%) 269ms 273ms p=0.011 n=6
Req 4 - navto 228ms (± 0.18%) 229ms (± 2.33%) ~ 226ms 240ms p=0.797 n=6
Req 5 - completionInfo count 1,519 1,519 ~ ~ ~ p=1.000 n=6
Req 5 - completionInfo 81ms (± 4.87%) 68ms (± 3.39%) 🟩-13ms (-15.84%) 66ms 72ms p=0.004 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen 5,181ms (± 0.39%) 5,178ms (± 0.24%) ~ 5,162ms 5,195ms p=0.688 n=6
Req 2 - geterr 1,124ms (± 0.87%) 1,119ms (± 1.86%) ~ 1,087ms 1,145ms p=0.688 n=6
Req 3 - references 90ms (± 2.94%) 89ms (± 2.93%) ~ 86ms 92ms p=0.619 n=6
Req 4 - navto 456ms (± 0.63%) 456ms (± 1.64%) ~ 451ms 471ms p=0.466 n=6
Req 5 - completionInfo count 3,417 3,417 ~ ~ ~ p=1.000 n=6
Req 5 - completionInfo 815ms (± 1.19%) 823ms (± 1.07%) ~ 815ms 839ms p=0.260 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstate-main-1-tsserver - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - node (v18.15.0, x64)
Execution time 157.30ms (± 0.24%) 157.25ms (± 0.18%) ~ 156.09ms 159.88ms p=0.091 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 232.50ms (± 0.14%) 232.59ms (± 0.18%) +0.09ms (+ 0.04%) 231.13ms 245.95ms p=0.017 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 226.97ms (± 0.15%) 226.89ms (± 0.14%) -0.08ms (- 0.04%) 225.55ms 232.93ms p=0.037 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 227.23ms (± 0.17%) 227.15ms (± 0.13%) ~ 225.65ms 229.25ms p=0.066 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the top 400 repos with tsc comparing main and refs/pull/59277/merge:

Something interesting changed - please have a look.

Details

dubinc/dub

2 of 4 projects failed to build with the old tsc and were ignored

packages/utils/tsconfig.json

microsoft/vscode

4 of 53 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

src/tsconfig.json

noodle-run/noodle

tsconfig.json

  • error TS2322: Type '{ creator: string; card?: "summary_large_image"; images?: string[]; title: string; description: string; }' is not assignable to type 'Twitter | null'.

@intomyam
Copy link

@iisaduan
I have encountered this issue a few times, so I really appreciate you working on a fix.
Do you need any help before merging this PR?

@iisaduan
Copy link
Member Author

iisaduan commented Sep 11, 2024

@intomyam

Glad to hear that this would be useful! If there are other cases that you'd like to have checked, please let me know, and I can look into it when I start up on this again.

The current status of this PR is that the check is inconsistent because of the way we get properties from union types, so some simple/reasonable cases that should be checked don't get checked. Example:

const definedObj = { a: 1 } ;
const x: { a: 1 } = { ...( someBool ? definedObj : { b: 1 }) } // should error on `b`, but currently does not

In some cases, the order of the property definitions in the object will change whether it's checked or not. I spent some time looking into other ways to resolve property definitions (that also isn't slow), but I haven't had the chance to follow through completely

@jackTabsCode
Copy link

I've had bugs in production due to this longstanding TypeScript issue. I'm really excited to see where this will go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion: perform excess property checks when spreading an inline object literal
5 participants