We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
d.ts emit type error
https://www.typescriptlang.org/play?module=1#code/KYDwDg9gTgLgBAMwK4DsDGMCWEV2CpAWwDEoJCBlGKTFAcwGcAeNHB+AWWEICNgoGeEDHwATQVGABDUTgA2ATzjsa9ANoBdAHwAKAJRwA3gCg4cGArDA4ABSmwAjHAC8R02bhqA1sCW04PgoQCHBcvPyCUoJhfALevhpCIijiytS0dO4ecAD8odyxDPEKGlkeAFxwKMAAbvwalTERxRoA3O4Avu1mFla29jAATC5GnjZkVrB+uIHB-Y4N8zAOauMQkxaJXe6SMEhQuADyPABWwBgAdGiSUiI6BHJyBlFLg+0dxkA
export function enumFromStrings<const Members extends readonly string[]>() { type Part1 = { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }; type Part2 = { [Property in keyof Part1]: Part1[Property] }; return Object.create(null) as Part2; }
Emits d.ts:
export declare function enumFromStrings<const Members extends readonly string[]>(): { [Property in keyof { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }]: { [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }[Property]; };
Which errors:
Type 'Property' cannot be used to index type '{ [key in keyof Members as Members[key] extends string ? Members[key] : never]: Members[key]; }'.
In playground
I expect TypeScript to either error when trying to emit a d.ts file, or generate a valid d.ts file it can consume without error.
I have a workaround for the case where I hit this, so I'm mainly reporting this incase it helps TypeScript development.
The text was updated successfully, but these errors were encountered:
tree: update reference to TypeScript bug (#21299)
ab87bbd
## Description microsoft/TypeScript#56718 was fixed, but does not fix our issue so microsoft/TypeScript#58688 was filed and is now referenced. Also a few minor cleanups in the file I saw while working on it.
weswigham
Successfully merging a pull request may close this issue.
🔎 Search Terms
d.ts emit type error
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?module=1#code/KYDwDg9gTgLgBAMwK4DsDGMCWEV2CpAWwDEoJCBlGKTFAcwGcAeNHB+AWWEICNgoGeEDHwATQVGABDUTgA2ATzjsa9ANoBdAHwAKAJRwA3gCg4cGArDA4ABSmwAjHAC8R02bhqA1sCW04PgoQCHBcvPyCUoJhfALevhpCIijiytS0dO4ecAD8odyxDPEKGlkeAFxwKMAAbvwalTERxRoA3O4Avu1mFla29jAATC5GnjZkVrB+uIHB-Y4N8zAOauMQkxaJXe6SMEhQuADyPABWwBgAdGiSUiI6BHJyBlFLg+0dxkA
💻 Code
🙁 Actual behavior
Emits d.ts:
Which errors:
In playground
🙂 Expected behavior
I expect TypeScript to either error when trying to emit a d.ts file, or generate a valid d.ts file it can consume without error.
Additional information about the issue
I have a workaround for the case where I hit this, so I'm mainly reporting this incase it helps TypeScript development.
The text was updated successfully, but these errors were encountered: