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
typeTypeA=number;typeTypeB=boolean;typeDataTypeTwo<TextendsTypeA|TypeB>={one: Array<{two: Array<T>}>;};typeDataTypeThree<TextendsTypeA|TypeB>={one: Array<{two: Array<{three: Array<T>}>}>;};lettestingThreeErr: DataTypeThree<TypeA>={one: [{two: [{three: [true]}]}]// errors as expected};lettestingTwoErr: DataTypeTwo<TypeA>={one: [{two: [false]}]// errors as expected};// Uncomment these lines to see all errors// let testingTwoPre: DataTypeTwo<TypeA> = {// one: [{ two: [ 5 ] }]// };// let t2aPre: DataTypeTwo<TypeB> = testingTwoPre;lettestingThree: DataTypeThree<TypeA>={one: [{two: [{three: [5]}]}]};// Comment out this line to see error for t2a assignmentlett3a: DataTypeThree<TypeB>=testingThree;// Should error, but does notlettestingTwo: DataTypeTwo<TypeA>={one: [{two: [5]}]};lett2a: DataTypeTwo<TypeB>=testingTwo;// errors only if section above commented outletcheck: number="asdf";// always errors, as it should// Comment out L27 to see correct error on L32// Uncomment L27 and lines 18-21 to see all errors correctly// Works as expected in v4.4.4, but not any later versions
π Actual behavior
No errors on lines 27 and 32 (assigning an incompatible type).
π Expected behavior
Should error on those lines.
Additional information about the issue
The code works (i.e. gives correct errors) in version 4.4.4 (pg).
I assume this is to with depth limits, as it works fine for the two level case (DataTypeTwo) - though if the bad assignment comes after the three level case then even this error is not shown. (i.e. need to comment out line 27 in the example for the bad assignment to the DataTypeTwo variable to correctly error).
Even more oddly, if a bad assignment to a DataTypeTwo variable is made before the bad assignment to a DataTypeThree, the DataTypeThree assignment begins to error correctly. (Uncomment lines 18-21 in the example).
Thanks for that workaround, though upon investigating it, it still doesn't seem to always work, such as when assigning a name to those generic types (i.e. type DataTypeThreeA = DataTypeThree<TypeA>).
In this pg an error isn't generated, unless lines 10-15 aren't commented out (or lines 18-21 as before).
π Search Terms
error, nested, array, order
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.6.3#code/C4TwDgpgBAKuEEEoF4oDsCuBbARhATgNwBQoks8AQilDgPZ0A2EAhmiWdACIvAtyQYAdzoAeGFAgAPYBDQATAM4VISAD4qIlAHw0A3sShQ6aCAC4oCfPhYhReqMBEXL12+N0BfbSU8d4UDx8AhAwABb4EBDikjJySprqmjr6hsamFlY2dg5OdJluOY4RUQXZHlDelT7EfsTEzMCOEIrAAJZoAObhkRAAotYWQfzwPVHi8Ai6qAZGJuZQANq5zktQesAlC4uO+BjQALqVUAeeRwD055LWdPjKLMrSkADGsvK1JI3NrR3dIgP4Ia8EaCEQTVTTdZpeYWZaOVY7ABmLEYikOlQuVwI+Fu90eUhebw+9UuUAAqmhnnQsFg5E1Ni1oIwOi1HHQoGjoCjGNccXdiKSvrIfl1hHQAAqRIHBUZgkJTVKkuYZJYrfJrACsJwxAqudUFEHpACYWJKFsMQmLwVpIcL2qKRGaSA1Dd97d0ttKQaEttaFTNoSq4XlYetNr1Q1qjp4TmdiaSAMLU2loJp0DD0sJtZTM0xsjlRXm3KCI4vAE1QB6KNqdNAp4Au+kAZhYXstvpCKVQdt+YwghCgpIAymF04x5EX8AAaWgZqDyOistB0BuNt291YW2VieWQ2bpbZqyPauN1IUmtvb61d9cOugD0nY3HpRggKBtREF15tEyV+gAN2gKkaTpCAJ3TVcvmeMIIGeABrCxMFwAgaAAIgeeREVQh8rhRIRbEeG47hnB53yaRRRwwccSSuJMQNTYw5wAGSNAB2fNOSgKlrFgpon3wdIoCYpsjV1clKWTOkhLYysFCgXNWQARgADgAWiNRSOMLblJ2UbjIleV8aKgAB1W44LxWJCTA980Cgf8ABYADpnIcmccDnZcmjYN9GF4FDALuH80EUYggA
π» Code
π Actual behavior
No errors on lines 27 and 32 (assigning an incompatible type).
π Expected behavior
Should error on those lines.
Additional information about the issue
The code works (i.e. gives correct errors) in version 4.4.4 (pg).
I assume this is to with depth limits, as it works fine for the two level case (
DataTypeTwo
) - though if the bad assignment comes after the three level case then even this error is not shown. (i.e. need to comment out line 27 in the example for the bad assignment to theDataTypeTwo
variable to correctly error).Even more oddly, if a bad assignment to a
DataTypeTwo
variable is made before the bad assignment to aDataTypeThree
, theDataTypeThree
assignment begins to error correctly. (Uncomment lines 18-21 in the example).Possibly related to #56291.
The text was updated successfully, but these errors were encountered: