-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedNeeds ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.This issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScriptAn idea for TypeScript
Description
There are cases, where a property can not just be any string (or a set of strings), but needs to match a pattern.
let fontStyle: 'normal' | 'italic' = 'normal'; // already available in master
let fontColor: /^#([0-9a-f]{3}|[0-9a-f]{6})$/i = '#000'; // my suggestion
It's common practice in JavaScript to store color values in css notation, such as in the css style reflection of DOM nodes or various 3rd party libraries.
What do you think?
watzon, stepancar, guid-empty, rylphs, osnr and 1884 moreDean177, Carlos0934, hash, macabeus, rmolinamir and 4 moretonkotsuboy, karvulf, strusoftsawen, Lorttexwolf, jamiehaywood and 33 moreGrahnz, ErikCupal, lgleim, Vaelor, DanielKucal and 167 morenusje2000, jakow, ErikCupal, vfhrr, lgleim and 296 moreaxelthat, MartinJaskulla, sptanco, vopnijam, Tobertet and 127 morej-oliveras, amitbeck, kaleidawave, unao, AmrAlSayed0 and 68 more
Metadata
Metadata
Assignees
Labels
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedNeeds ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.This issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScriptAn idea for TypeScript