-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed as not planned
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
Autocomplete works for literal string unions, but adding a union of string
negates autocomplete entirely. This has been brought up before but I believe there is enough value in this feature to be reconsidered.
My use case is to have a union of string literals for several colors, but also allow hex codes without having to add 16.7 million string literals.
TypeScript Version: 3.4.0-dev.20190202
Search Terms: Literal string union autocomplete
Code
interface Options {
borderColor: 'black' | 'red' | 'green' | 'yellow' | 'blue' | string
};
const opts: Options = {borderColor: 'red'};
Expected behavior:
Actual behavior:
Playground Link: https://stackblitz.com/edit/typescript-bwyyab
sindresorhus, SamVerschueren, kevva, spcfran, willhoney7 and 234 moreandorthehood, smashercosmo, a2br, Luiz-Monad, chrisblossom and 4 more
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed