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
typeSomePropertyKeys=ReadonlyArray<PropertyKey>typeAt<AextendsReadonlyArray<unknown>,Iextendsnumber=number>=A[I]exportfunctionmainKeyGuard<Kextendsreadonly[PropertyKey, ...SomePropertyKeys],>(keys: K,): <Textendsobject>(value: T,)=>value is Extract<T,Record<At<K,0>,unknown>>{return<Textendsobject>(value: T,): value is Extract<T,Record<At<K,0>,unknown>>=>{returnkeys[0]invalue}}typeFoo={foo1: string,foo2: string}typeBar={bar1: string,bar2: string}typeFooBar=Foo|BarconstbarKeys=['bar1','bar2']asconstexportconstisBar=mainKeyGuard(barKeys)<FooBar>
π Actual behavior
Starting with the v5.7.2, the generated d.ts file declares isBar as a function which reference a missing generic type T, so an error is raised
exportdeclareconstisBar: (value: FooBar)=>value is Extract<T,Record<At<K,0>,unknown>>;
π Expected behavior
I would expect the isBar function d.ts declaration to not reference a missing generic type T.
Previously, the generated d.ts file behaved like the following
exportdeclareconstisBar: (value: FooBar)=>value is Bar;
Additional information about the issue
The title mentions "instantiation expression" but I'm not totally sure about how the involved feature is actually named
The text was updated successfully, but these errors were encountered:
The above will generate let nr: (a: [number, number]) => a is [T, K]; which seems to indicate T and K are correctly resolved for parameters but not in parameters but not for predicates. Also If the outer function does not have a type parameter everything works (Playground Link).
π Search Terms
partial function generic application, function generic variant from another function, instantiation-expressions
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.7.2#code/C4TwDgpgBAyg9gWwgBQE50q0BpCIDOUAvFAEoQCGAJnAHYA2IAgqqhSADxoYRYi4gAfAChQkKE2AcmUCAA9gEWlULlqdRizacArrQDWtOAHdaggDRQAkrIVKVUWjoQAjXsUfO3qQR6YBtKwBdYWF5MDgsKAAzPQBjYABLOigECkTaAQBxHQpUKg5hKChsW0VlQlRKGgYQKH9uTBw8SwA6dvgkRt5mgiDzYUEACiKofTx8AC4SgYBKaY4AFTL7QjgXACsIBOHRgDcKeh0IacW54l8Do+hEwgBRBTYEpctyOMiCyQ5sSwAGCygekMJjMvgA3qMqsAdKhaFAlisKlB1lsdiNisUrsdTgNivMoFibvdHhRnmcyNsPtIpD8oP9LECjKZBL4iODRsUoTC4eMCP5fkEoBkCYdjqMAL7CSWicDQABicDgHjBMUVAEZpvhgKgMgBzSzRRUAJk12r1UElYmgACE8sqoC48hqoFqdbR9Q68iaXWb3RaZeIFXBbagPEGoAAfKAh4TvWhaz2oASEEj+ADkjtQarTlgzXrTgoohDjWrCcgiURLwCF+BDHjSGWyuXyQ0zydmHCDIZEoSAA
π» Code
π Actual behavior
Starting with the v5.7.2, the generated d.ts file declares
isBar
as a function which reference a missing generic type T, so an error is raisedπ Expected behavior
I would expect the
isBar
function d.ts declaration to not reference a missing generic type T.Previously, the generated d.ts file behaved like the following
Additional information about the issue
The title mentions "instantiation expression" but I'm not totally sure about how the involved feature is actually named
The text was updated successfully, but these errors were encountered: