You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression in type inference from 2.5 -> 2.6 #19668
I'm getting lots of errors when I compile the example (after installing the referenced npm modules). In particular, many of the errors relate to the fix implemented in #17922. It appears the @hediet/typed-sql package attempts to access type parameters in a base class expression. This never worked correctly and is now an error. See #17829 (comment) for how to implement this pattern correctly.
Right, compiling with tsc does indeed show type errors in the library, in VSCode it does not show them. Henning Dieterichs (@hediet), can you look into it?
Record<NodeProps<N>>(defaultNode) does not make sense since Record requires 2 type parameters, a class cannot extend a type, and a type cannot be called. Are you trying to write a mixin?
I'm using version 4.0.0-rc.9 of immutable which only requires a single type parameter (TProps) for defining a Record. The two relevant type definitions:
Extending from Record is documented in the docs and it works correctly except when using a generic interface as TProps . This used to work incorrectly, using any instead of the proper type parameter before 2.6 and fails with a compile-time error after 2.6.
Here's a minimal repro that (unlike Record) happens to work correctly with 2.5 but still fails with 2.6:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
ahejlsberg commentedon Nov 1, 2017
I'm getting lots of errors when I compile the example (after installing the referenced npm modules). In particular, many of the errors relate to the fix implemented in #17922. It appears the
@hediet/typed-sqlpackage attempts to access type parameters in a base class expression. This never worked correctly and is now an error. See #17829 (comment) for how to implement this pattern correctly.phiresky commentedon Nov 2, 2017
Right, compiling with tsc does indeed show type errors in the library, in VSCode it does not show them. Henning Dieterichs (@hediet), can you look into it?
zsparal commentedon Nov 2, 2017
Is there an easy way to properly type generic classes that extend from a class expression? The use-case is Immutable.js's
Recordclass:Common:
Here's what I want to do:
Unfortunately this gives me
Node.value: anyso here's what I came up with as a workaround:Is there a better way to go about this?
Edit: Sorry if this belongs to #17829
aluanhaddad commentedon Nov 4, 2017
Record<NodeProps<N>>(defaultNode)does not make sense sinceRecordrequires 2 type parameters, a class cannot extend a type, and a type cannot be called. Are you trying to write a mixin?zsparal commentedon Nov 5, 2017
I'm using version
4.0.0-rc.9ofimmutablewhich only requires a single type parameter (TProps) for defining a Record. The two relevant type definitions:Extending from
Recordis documented in the docs and it works correctly except when using a generic interface asTProps. This used to work incorrectly, usinganyinstead of the proper type parameter before 2.6 and fails with a compile-time error after 2.6.Here's a minimal repro that (unlike
Record) happens to work correctly with 2.5 but still fails with 2.6:aluanhaddad commentedon Nov 5, 2017
Ah, I see, I though you were referencing TypeScript's built in
Record<K, T>mapped type. Since as mentioned was never correct, you can either writeto obtain an approximation of the old behavior.
Or write
to pass the type parameter to the expression that results from calling the class factory.
typescript-bot commentedon Nov 20, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.