Closed
Description
It would be nice to be able to use a variable declared as const
as a literal type in a type annotation.
TypeScript Version: 2.0.0
Code
export const INCREMENT = 'INCREMENT';
export const DECREMENT = 'DECREMENT'
export const ADD = 'ADD';
type Action =
{ type: INCREMENT }
| { type: DECREMENT };
Expected behavior:
No error, type Action
is { type: 'INCREMENT' } | { type: 'DECREMENT' }
.
Actual behavior:
Error: Cannot find name INCREMENT