-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Constraints for generic tuple types #53672
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
Conversation
@typescript-bot test this |
Heya @ahejlsberg, I've started to run the diff-based user code test suite on this PR at 812b92f. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the diff-based top-repos suite on this PR at 812b92f. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at 812b92f. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at 812b92f. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at 812b92f. You can monitor the build here. Update: The results are in! |
@ahejlsberg Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@ahejlsberg Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Details
|
Hey @ahejlsberg, the results of running the DT tests are ready. |
@ahejlsberg Here they are:Comparison Report - main..53672
System
Hosts
Scenarios
Developer Information: |
@ahejlsberg will this PR fix also #53256? |
@awerlogus Yes, I'll make sure it does. |
@typescript-bot test this |
Heya @ahejlsberg, I've started to run the diff-based user code test suite on this PR at ed4e812. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at ed4e812. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at ed4e812. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the diff-based top-repos suite on this PR at ed4e812. You can monitor the build here. Update: The results are in! |
@ahejlsberg Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@ahejlsberg Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Details
|
Hey @ahejlsberg, the results of running the DT tests are ready. |
@ahejlsberg please take a look at these two examples which are also related to generic tuple types // No error, but expected
const a = <T extends [unknown]>(x: T): T[0] => 123
// string type, but number value
const b = a(['']) declare const a: <T extends [unknown]>(x: T[0]) => void
// const a: <[unknown]>(x: unknown) => void
a('123')
// It would be nice if type of 0 element of T will be inferred from type of argument passed as x |
@typescript-bot test this |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at ee429dd. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the diff-based user code test suite on this PR at ee429dd. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at ee429dd. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at ee429dd. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the diff-based top-repos suite on this PR at ee429dd. You can monitor the build here. Update: The results are in! |
@ahejlsberg Here they are:Comparison Report - main..53672
System
Hosts
Scenarios
Developer Information: |
Hey @ahejlsberg, it looks like the DT test run failed. Please check the log for more details. |
@ahejlsberg Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Details
|
@typescript-bot test this |
Heya @ahejlsberg, I've started to run the diff-based top-repos suite on this PR at 417f154. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at 417f154. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the diff-based user code test suite on this PR at 417f154. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at 417f154. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at 417f154. You can monitor the build here. Update: The results are in! |
@ahejlsberg Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@ahejlsberg Here they are:Comparison Report - main..53672
System
Hosts
Scenarios
Developer Information: |
Hey @ahejlsberg, the results of running the DT tests are ready. |
@ahejlsberg Here are the results of running the top-repos suite comparing Everything looks good! |
Tests all look good and performance is unaffected (though some noise in the various runs). This one is ready to merge. |
Is this a separate issue? type NTuple<N extends number, A extends any[] = []> =
A['length'] extends N ? A : NTuple<N, [any, ...A]>;
type X<N extends number> = `${[...NTuple<N>]['length']}`; // error
// ^? (property) length: number
// Type '[...NTuple<N, []>]["length"]' is not assignable to type
// 'string | number | bigint | boolean | null | undefined'.(2322) Seems related but maybe something about generic recursive tuple types makes this different? Comes from this SO question |
Fixes #53256.
Fixes #53563.