That's why I occasionally list specific options in addition to the larger parent type, just for the IDE, not for the type checks.
TypeScript mixes a lot of things and tools that are actually separate things and presents it in one big package, for better or worse, not just in this case.
(keyof typeof someObject | (string & Record<never, never>))[]
which will give you autocomplete but still allow arbitrary strings. TS will still complain as soon as you use it as an object indexer though, defeating the point.Yes it does! I even tried it just to be sure with just that example "a" | "b" | string. The Playground and Webstorm both provided correct completions, Playground added a lot of wrong useless stuff, Webstorm - using tsc service I guess - only "a" and "b" as possible values (there is nothing concrete to other string after all).
It also works when the type is defined in another file/module.
Playground: https://www.typescriptlang.org/play?noUnusedLocals=true&noUn...
I don't know where exactly the suggestions come from, if it's the language service or something else. Why would that matter? The only point I care about is that those suggestions are made, making those useless-for-type-checks union components still useful. I found WebStorm to show them even after I unchecked the TS language service in the settings. So what?