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
Reduced example, the code on the playground is an actual function from our codebase that used to work fine.
typeTimestampColumns<T>={[KinkeyofT]: T[K]extendsDate ? K : never}[keyofT];functiongetTimestamp<RowextendsRecord<string,unknown>,KextendsTimestampColumns<Row>>(row: Row,timestampColumn: K,): number{constdate: Date=row[timestampColumn];// This used to work;returndate.valueOf();}
π Actual behavior
The code should compile with no warnings or errors.
π Expected behavior
Fails with error Type 'Row[K]' is not assignable to type 'Date'.
The text was updated successfully, but these errors were encountered:
Fryuni
changed the title
Narrowing of struct
Narrowing of generic type parameter
May 6, 2022
Fryuni
changed the title
Narrowing of generic type parameter
Narrowing of generic type parameter index
May 6, 2022
Bug Report
π Search Terms
narrowing generic parameter
π Version & Regression Information
β― Playground Link
Playground link with relevant code
Changing the version to 4.4.4 works
π» Code
Reduced example, the code on the playground is an actual function from our codebase that used to work fine.
π Actual behavior
The code should compile with no warnings or errors.
π Expected behavior
Fails with error
Type 'Row[K]' is not assignable to type 'Date'.
The text was updated successfully, but these errors were encountered: