Issue
Is it possible to do something like:
type TrueType = true;
const someVar = GetTypeValue<TrueType>(); // This is where the value true is written
Is it possible to write other constant values to constant variables like in C++?
Solution
Typing helps at compile time but not at runtime.
You can use this strategy at compile time to get the value safely:
type TrueType = true;
const myTrue: TrueType = true;
Answered By - Robert Rendell
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.