#What the typescript evaluates to?

8 messages · Page 1 of 1 (latest)

sturdy walrus
#

In several tutorials and blog posts I've read, there's usually a sentence explaining what some piece of typescript code "evaluates" to, such as ```Which just evaluates to

type TestType = ${string} A | ${string} B | ${string} C | 'Test D' | 'Test E'``` How do I take a piece of typescript code and find out what it evaluates to?

trim fossil
#

@sturdy walrus Generally, you just mouse over the type and see what it is.

sturdy walrus
#

in the editor?

trim fossil
#

Yeah, or the Typescript playground.

#

Another useful trick can be:

declare const x: TheType;
x. //... see what autocompletes here
#

For your example, I don't know that I'd say that type 'evaluates to' anything - that's already pretty much a fully-evaluated type.

sturdy walrus
#

ok

#

thank you'