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

[NewErrors] 4.3.0-dev.20210412 vs 4.2.4 #43651

Closed
typescript-bot opened this issue Apr 12, 2021 · 6 comments
Closed

[NewErrors] 4.3.0-dev.20210412 vs 4.2.4 #43651

typescript-bot opened this issue Apr 12, 2021 · 6 comments
Labels
Infrastructure Issue relates to TypeScript team infrastructure

Comments

@typescript-bot
Copy link
Collaborator

The following errors were reported by 4.3.0-dev.20210412, but not by 4.2.4

cdr/code-server

9 of 52 projects failed to build with the old tsc

lib/vscode/extensions/html-language-features/server/tsconfig.json

lib/vscode/extensions/typescript-language-features/tsconfig.json

lib/vscode/extensions/vscode-custom-editor-tests/tsconfig.json

lib/vscode/src/tsconfig.monaco.json

ReactiveX/rxjs

7 of 11 projects failed to build with the old tsc

src/tsconfig.cjs.spec.json

src/tsconfig.esm5.rollup.json

typeorm/typeorm

tsconfig.json

microsoft/playwright

2 of 4 projects failed to build with the old tsc

utils/generate_types/test/tsconfig.json

streamich/react-use

tsconfig.json

react-hook-form/react-hook-form

2 of 4 projects failed to build with the old tsc

tsconfig.jest.json

  • error TS2739: Type '{}' is missing the following properties from type 'ControllerFieldState': invalid, isTouched, isDirty, isValidating

tsconfig.json

  • error TS2739: Type '{}' is missing the following properties from type 'ControllerFieldState': invalid, isTouched, isDirty, isValidating

react-navigation/react-navigation

example/tsconfig.json

tsconfig.json

excalidraw/excalidraw

2 of 4 projects failed to build with the old tsc

tsconfig-types.json

  • error TS2322: Type '({ id: string; x: number; y: number; strokeColor: string; backgroundColor: string; fillStyle: FillStyle; strokeWidth: number; strokeStyle: StrokeStyle; strokeSharpness: StrokeSharpness; ... 17 more ...; endArrowhead: Arrowhead | null; } & ElementUpdate<...> & { ...; }) | ... 4 more ... | ({ ...; } & ... 1 more ... &...' is not assignable to type 'TElement'.

tsconfig.json

  • error TS2322: Type '({ id: string; x: number; y: number; strokeColor: string; backgroundColor: string; fillStyle: FillStyle; strokeWidth: number; strokeStyle: StrokeStyle; strokeSharpness: StrokeSharpness; ... 17 more ...; endArrowhead: Arrowhead | null; } & ElementUpdate<...> & { ...; }) | ... 4 more ... | ({ ...; } & ... 1 more ... &...' is not assignable to type 'TElement'.

davidkpiano/xstate

4 of 10 projects failed to build with the old tsc

packages/xstate-inspect/tsconfig.json

packages/xstate-svelte/tsconfig.json

packages/xstate-test/tsconfig.json

packages/xstate-vue/tsconfig.json

rome/tools

tsconfig.json

  • error TS2345: Argument of type 'AnyNode' is not assignable to parameter of type 'Omit<Node, "type">'.
  • error TS2322: Type '{ loc: undefined; type: "HTMLDoctypeTag"; value: string; leadingComments?: string[] | undefined; trailingComments?: string[] | undefined; innerComments?: string[] | undefined; } | { loc: undefined; ... 7 more ...; innerComments?: string[] | undefined; } | ... 300 more ... | { ...; }' is not assignable to type 'T'.
  • error TS2322: Type '{ type: "HTMLDoctypeTag"; value: string; leadingComments?: string[] | undefined; trailingComments?: string[] | undefined; innerComments?: string[] | undefined; loc?: SourceLocation | undefined; } | ... 301 more ... | { ...; }' is not assignable to type 'T'.
  • error TS2322: Type '{ leadingComments: undefined; trailingComments: undefined; innerComments: undefined; type: "HTMLDoctypeTag"; value: string; loc?: SourceLocation | undefined; } | { leadingComments: undefined; ... 7 more ...; loc?: SourceLocation | undefined; } | ... 300 more ... | { ...; }' is not assignable to type 'T'.
  • error TS2322: Type '{ loc: SourceLocation; type: "HTMLDoctypeTag"; value: string; leadingComments?: string[] | undefined; trailingComments?: string[] | undefined; innerComments?: string[] | undefined; } | ... 301 more ... | { ...; }' is not assignable to type 'T & { loc: SourceLocation; }'.
  • error TS2345: Argument of type '{ relativeSegments: PathSegments; explicitDirectory: boolean; type: "absolute-windows-drive"; letter: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | ... 14 more ... | "Z"; } | ... 5 more ... | { ...; }' is not assignable to parameter of type 'SuperParsed'.
  • error TS2345: Argument of type '{ relativeSegments: string[]; type: "absolute-windows-drive"; letter: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | ... 5 more ... | "Z"; explicitDirectory: boolean; } | ... 5 more ... | { ...; }' is not assignable to parameter of type 'SuperParsed'.
  • error TS2345: Argument of type '{ explicitDirectory: true; relativeSegments: PathSegments; type: "absolute-windows-drive"; letter: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | ... 13 more ... | "Z"; } | ... 5 more ... | { ...; }' is not assignable to parameter of type 'SuperParsed'.
  • error TS2345: Argument of type '{ explicitDirectory: false; type: "absolute-windows-drive"; letter: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | ... 5 more ... | "Z"; relativeSegments: PathSegments; } | ... 5 more ... | { ...; }' is not assignable to parameter of type 'SuperParsed'.

sindresorhus/refined-github

tsconfig.json

jquense/yup

1 of 2 projects failed to build with the old tsc

test/tsconfig.json

  • error TS2612: Property 'spec' will overwrite the base property in 'BaseSchema<TIn, TContext, TOut>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

wangeditor-team/wangEditor

cypress/tsconfig.json

tsconfig.json

@DanielRosenwasser
Copy link
Member

I've done my best to look through the major gotchas and tag the right people.


streamich/react-use

tsconfig.json

  • error TS2345: Argument of type 'Window | ListenerType1' is not assignable to parameter of type 'Window | null'.

wangeditor-team/wangEditor

cypress/tsconfig.json

  • error TS2322: Type 'DomElement<DomElementSelector>' is not assignable to type 'DomElement<T>'.

@ahejlsberg looks like these may be a regressions from on-demand generic narrowing.

Side note:

error TS2322: Type 'HTMLElement[] | ChildNode[]' is not assignable to type 'HTMLElement[]'.

I think this one is caused by generic narrowing, but is a legit error.

error TS2578: Unused '@ts-expect-error' directive.

I think this one is improved inference from generic narrowing.


react-hook-form/react-hook-form

2 of 4 projects failed to build with the old tsc

tsconfig.jest.json

  • error TS2739: Type '{}' is missing the following properties from type 'ControllerFieldState': invalid, isTouched, isDirty, isValidating

@sandersn @orta this looks like a regression from #42424

I'm cautiously optimistic that this won't break anything, since there wasn't much churn in the test baselines.

lol


typeorm/typeorm

tsconfig.json

@andrewbranch you already put a fix in for this, right? Or is it still outstanding in some way?


davidkpiano/xstate

4 of 10 projects failed to build with the old tsc

packages/xstate-inspect/tsconfig.json

@weswigham something something about substitution types? 😬


The Rome issues all look correct, but I'm surprised they're new. They all relate to spreading a T and trying to assign it back to a T which is not exactly safe.

@weswigham
Copy link
Member

@DanielRosenwasser #43599 should handle the one pointed my way.

@andrewbranch
Copy link
Member

@andrewbranch you already put a fix in for this, right? Or is it still outstanding in some way?

#43593

@DanielRosenwasser DanielRosenwasser added the Infrastructure Issue relates to TypeScript team infrastructure label Apr 13, 2021
@sandersn
Copy link
Member

@orta I have really mixed feelings about #42424. On the one hand, a single break isn't that bad, and the workaround is casting {} as ControllerFieldState -- reasonably obvious. On the other hand, as far as I know defineProperties is primarily used to add, not overwrite, properties, which means that reusing the input type will always lack the new properties. So I'm not sure the change is actually useful. I'm leaning toward reverting. What is your opinion?

@orta
Copy link
Contributor

orta commented Apr 14, 2021

Heh, I'm leaning toward not reverting. But not strongly.

This change does force you to declare to the type system what you are expecting the result of those Object.defineProperties, prior to this you had an any gap. Admittedly it's a little ambiguous (because you have no guarantee that the thing you set up is the thing you expect) but I think it's a bit tighter and more accurate.

@sandersn
Copy link
Member

Well here's some data that I should have collected before merging:

  1. Object.defineProperties is rare in TS. The only uses I found in DT+user tests were in some tests (which were almost certainly copied from JS documentation).
  2. It's common in generated JS, where I don't care about logging errors.
  3. 80% of uses are side-effecting, where the return type isn't used, and this change doesn't help or hurt.
  4. That leaves 150-ish other uses, which are syntactically all over the place, but the majority of them are infrastructure talking about Object.defineProperties in some way, like a polyfill or a mock. Any errors are likely to be downstream, but are quite unlikely in JS code.
  5. About 20 of those uses alias Object.defineProperties to props or something -- I didn't analyse any of these aliased uses.

The truth is that rarely logging an extra error in JS isn't that bad either. People with // @ts-check are used to seeing+ignoring errors, and if they're heavy checkJS users, they'll have already switched to classes or Object.defineProperty since those are supported.

This is a big shrug for me, so I think I'll leave it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issue relates to TypeScript team infrastructure
Projects
None yet
Development

No branches or pull requests

6 participants