Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
xg15
4y ago
0 comments
Share
Yes, that's correct. In the GP example, c was const, so the type can be determined at compile time.
0 comments
default
newest
oldest
simulate-me
4y ago
I was writing TypeScript, where const just means the variable is not reassigned. For instance this is valid:
const c: C = Math.random() < 0.5 ? { type: 'a' } : { type: 'b' }.
xg15
OP
4y ago
Ah, I'm sorry. You're right of course!
j
/
k
navigate · click thread line to collapse