When you create a type alias and use it, for example, in the signature of an exported method, the intellisense tips you get for that method show the alias, not the real underlying type. Is there a way to opt out of that for a given type?

I can see that in some/most cases this is what you want, but sometimes the alias was created just because the full type expression was repetitive or cumbersome in the source file, but externally, the alias is an opaque name which doesn't help the consumer know how to fulfill it.
Typescript uses some heuristics to decide when to preserve the type alias or when to expand it out. We don't really have much control over it and the heuristics may change from version to version based on feedback and bugs.
That being said, we can sometimes take advantage of what the compiler does to force the expansion of a type alias. For example this code will show the tool-tip you want, but requires changing the signature:
type AnAlias = (a: number) => string;
type FunctionSignature<T extends (...a: any) => any> = {} & ((...a: Parameters<T>) => ReturnType<T>)
declare function fn(a: FunctionSignature<AnAlias>): void
fn()
Playground Link

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With