Does TypeScript have a NaN type? [duplicate]
This question already has an answer here:
Integer (literal) union type, with NaN as valid return value
2 answers
Does TypeScript have a NaN type that I could declare for a variable?
For example, if I was to create a variable like this:
const number: number = parseInt('123', 10);
Could I change it to be more accurate, like so:
const number: number | NaN = parseInt('123', 10);
Basically I want to know if I can declare a variable as a NaN type (not undefined or null). The above snippet doesn't work in TypeScript and I can't find it listed in either the Basic or Advanced Types within TypeScript's guides.
javascript node.js angular typescript types
marked as duplicate by R. Richards, ConnorsFan, Community♦ Jan 1 at 23:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Integer (literal) union type, with NaN as valid return value
2 answers
Does TypeScript have a NaN type that I could declare for a variable?
For example, if I was to create a variable like this:
const number: number = parseInt('123', 10);
Could I change it to be more accurate, like so:
const number: number | NaN = parseInt('123', 10);
Basically I want to know if I can declare a variable as a NaN type (not undefined or null). The above snippet doesn't work in TypeScript and I can't find it listed in either the Basic or Advanced Types within TypeScript's guides.
javascript node.js angular typescript types
marked as duplicate by R. Richards, ConnorsFan, Community♦ Jan 1 at 23:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Definitely a duplicate but I couldn't find that so I'll leave my question. Thanks for your comment! I liked the explanation on that question
– Kyle
Jan 1 at 23:39
add a comment |
This question already has an answer here:
Integer (literal) union type, with NaN as valid return value
2 answers
Does TypeScript have a NaN type that I could declare for a variable?
For example, if I was to create a variable like this:
const number: number = parseInt('123', 10);
Could I change it to be more accurate, like so:
const number: number | NaN = parseInt('123', 10);
Basically I want to know if I can declare a variable as a NaN type (not undefined or null). The above snippet doesn't work in TypeScript and I can't find it listed in either the Basic or Advanced Types within TypeScript's guides.
javascript node.js angular typescript types
This question already has an answer here:
Integer (literal) union type, with NaN as valid return value
2 answers
Does TypeScript have a NaN type that I could declare for a variable?
For example, if I was to create a variable like this:
const number: number = parseInt('123', 10);
Could I change it to be more accurate, like so:
const number: number | NaN = parseInt('123', 10);
Basically I want to know if I can declare a variable as a NaN type (not undefined or null). The above snippet doesn't work in TypeScript and I can't find it listed in either the Basic or Advanced Types within TypeScript's guides.
This question already has an answer here:
Integer (literal) union type, with NaN as valid return value
2 answers
javascript node.js angular typescript types
javascript node.js angular typescript types
edited Jan 2 at 2:25
Dale Burrell
3,25932553
3,25932553
asked Jan 1 at 23:18
KyleKyle
5415
5415
marked as duplicate by R. Richards, ConnorsFan, Community♦ Jan 1 at 23:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by R. Richards, ConnorsFan, Community♦ Jan 1 at 23:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Definitely a duplicate but I couldn't find that so I'll leave my question. Thanks for your comment! I liked the explanation on that question
– Kyle
Jan 1 at 23:39
add a comment |
1
Definitely a duplicate but I couldn't find that so I'll leave my question. Thanks for your comment! I liked the explanation on that question
– Kyle
Jan 1 at 23:39
1
1
Definitely a duplicate but I couldn't find that so I'll leave my question. Thanks for your comment! I liked the explanation on that question
– Kyle
Jan 1 at 23:39
Definitely a duplicate but I couldn't find that so I'll leave my question. Thanks for your comment! I liked the explanation on that question
– Kyle
Jan 1 at 23:39
add a comment |
1 Answer
1
active
oldest
votes
There is no NaN
type in Typescript. There is a proposal for this on GitHub but there is no timeline for implementation. Consider upvoting the issue if you want to see this feature in Typescript.
Oh cool! I definitely want to see this feature, thank you
– Kyle
Jan 1 at 23:33
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no NaN
type in Typescript. There is a proposal for this on GitHub but there is no timeline for implementation. Consider upvoting the issue if you want to see this feature in Typescript.
Oh cool! I definitely want to see this feature, thank you
– Kyle
Jan 1 at 23:33
add a comment |
There is no NaN
type in Typescript. There is a proposal for this on GitHub but there is no timeline for implementation. Consider upvoting the issue if you want to see this feature in Typescript.
Oh cool! I definitely want to see this feature, thank you
– Kyle
Jan 1 at 23:33
add a comment |
There is no NaN
type in Typescript. There is a proposal for this on GitHub but there is no timeline for implementation. Consider upvoting the issue if you want to see this feature in Typescript.
There is no NaN
type in Typescript. There is a proposal for this on GitHub but there is no timeline for implementation. Consider upvoting the issue if you want to see this feature in Typescript.
answered Jan 1 at 23:22
Titian Cernicova-DragomirTitian Cernicova-Dragomir
68.1k34764
68.1k34764
Oh cool! I definitely want to see this feature, thank you
– Kyle
Jan 1 at 23:33
add a comment |
Oh cool! I definitely want to see this feature, thank you
– Kyle
Jan 1 at 23:33
Oh cool! I definitely want to see this feature, thank you
– Kyle
Jan 1 at 23:33
Oh cool! I definitely want to see this feature, thank you
– Kyle
Jan 1 at 23:33
add a comment |
1
Definitely a duplicate but I couldn't find that so I'll leave my question. Thanks for your comment! I liked the explanation on that question
– Kyle
Jan 1 at 23:39