1. I think there is not a direct way to specify whether a number is integer or floating point. In the TypeScript specification section 3.2.1 we can see:

    "...The Number primitive type corresponds to the similarly named JavaScript primitive type and represents double-precision 64-bit format IEEE 754 floating point values..."

  2. I think int is a bug in Visual Studio intelliSense. The correct is number.

Answer from Diullei on Stack Overflow
🌐
TypeScript Tutorial
typescripttutorial.net › home › typescript tutorial › typescript number
TypeScript Number
October 18, 2024 - The floating-point numbers have the type number while the big integers get the type bigint. The following shows how to declare a variable that holds a floating-point value: let price: number;Code language: JavaScript (javascript) Alternatively, you can initialize the price variable to a number: ...
🌐
typescriptlang.org
typescriptlang.org › docs › handbook › 2 › everyday-types.html
TypeScript: Documentation - Everyday Types
Each has a corresponding type in TypeScript. As you might expect, these are the same names you’d see if you used the JavaScript typeof operator on a value of those types: string represents string values like "Hello, world" number is for numbers like 42. JavaScript does not have a special runtime value for integers...
🌐
Codefinity
codefinity.com › courses › v2 › 3c6ec5e9-886b-465a-b174-93d7470b0c0c › 55bada62-f978-4c4f-bed0-c9e19e1e1e8c › fadf9301-bb43-4ef5-9128-7b4bf1ef9d46
Learn Number Type | Core TypeScript Types
TypeScript uses the number type to represent both integer and floating-point values. This means you do not need to distinguish between whole numbers and decimals—TypeScript treats them all as number.
🌐
The Tombomb
thetombomb.com › posts › typescript-there-are-no-integers
Typescript: There are no integers! 😱
Returned to me was 212.1. And it ... the day. But I want to write this post to help me remember. There is no integer type in Typescript only floating-point!...
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › typescript-numbers
TypeScript Numbers - GeeksforGeeks
August 9, 2024 - TypeScript treats numbers as both integers and floating-point values.
🌐
Medium
medium.com › interesting-coding › all-typescript-types-you-need-to-know-dd1423fd6687
All TypeScript Types You Need To Know | by Cihan | Interesting Coding | Medium
November 10, 2023 - In TypeScript, there are several ... boolean: Represents a value that is either true or false. number: Represents a numeric value, either integer or floating-point....
🌐
Tutorial Teacher
tutorialsteacher.com › typescript › typescript-number
TypeScript number Data Type
Example: TypeScript Number Type Variables Copy · let first:number = 123; // number let second: number = 0x37CF; // hexadecimal let third:number=0o377 ; // octal let fourth: number = 0b111001;// binary console.log(first); // 123 console.log(second); // 14287 console.log(third); // 255 console.log(fourth); // 57 · In the above example, let first:number = 1; stores a positive integer as a number.let second: number = 0x37CF; stores a hexadecimal as a number which is equivalent to 14287.
🌐
Tektutorialshub
tektutorialshub.com › home › typescript › typescript number data type
TypeScript Number Data Type - Tektutorialshub
March 15, 2023 - One is a primitive number data type. The other one is BigInt, which is a recent addition. It does not have separate data types like integers, decimal, float as in the other languages.
Find elsewhere
🌐
Artful
journal.artful.dev › what-you-risk-when-using-number-to-parse-an-integer-from-a-string-in-typescript
What you risk when using Number() to parse an integer from a string in TypeScript
May 15, 2023 - Because of this, TypeScript warns us if we call parseInt with an invalid input. If we use Number, we‘re left with no such type safety.
Top answer
1 of 2
38

number is only a TypeScript thing - it's a primitive type referring to, well, a number.

But, judging by the error message, it seems that number isn't actually a discrete value like Number.

Indeed - it's a type, so it doesn't exist in emitted code.

a discrete value like Number. On the other hand, user-defined types like classes appear to be discrete values (as they also print the standard function description).

Yes. Classes, of which Number is one, are special. They do two things, somewhat unintuitively:

  • They create a JavaScript class (usable in emitted code)
  • They also create an interface for the class (only used by TypeScript)

If you use Number in a place where a type is expected, TypeScript will not complain, because Number is an interface.

If you use Number in a place where a value (something that exists in emitted code) is expected, TypeScript will not complain, because Number is also a global constructor.

In other words, the two Numbers below refer to completely different things:

// refer to the TypeScript Number interface
let foo: Number;

// refer to the JavaScript global.Number constructor
const someNum = Number(someString);

Using Number in TypeScript is very odd, since it'd, strictly, speaking, refer to a number created via new:

const theNum = new Number(6);

Which there's almost never a reason to do. Use a plain primitive number instead, without an object wrapper.

const theNum = 6;
// theNum is typed as `number`
2 of 2
1

From https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean:

JavaScript has three very commonly used primitives: string, number, and boolean. Each has a corresponding type in TypeScript. As you might expect, these are the same names you’d see if you used the JavaScript typeof operator on a value of those types:

  • string represents string values like "Hello, world"
  • number is for numbers like 42. JavaScript does not have a special runtime value for integers, so there’s no equivalent to int or float - everything is simply number
  • boolean is for the two values true and false

The type names String, Number, and Boolean (starting with capital letters) are legal, but refer to some special built-in types that will very rarely appear in your code. Always use string, number, or boolean for types.

(There are also typs for null and undefined)

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Number
Number - JavaScript | MDN
A number literal like 37 in JavaScript code is a floating-point value, not an integer. There is no separate integer type in common everyday use. (JavaScript also has a BigInt type, but it's not designed to replace Number for everyday uses.
🌐
TutorialsPoint
tutorialspoint.com › typescript › typescript_types.htm
TypeScript - Types
There is no integer type in TypeScript and JavaScript. Now, lets understand each built-in data type in detail. In TypeScript, the number data type can store the integer, floating point, binary, decimal, hexadecimal, etc.
🌐
Delft Stack
delftstack.com › home › howto › typescript › typescript integer type in typescript
How to Represent Integer in TypeScript | Delft Stack
February 2, 2024 - In TypeScript, there is no concept of integer data types like in other programming languages. Only a number type is used to represent floating-point numbers in general.
🌐
LinkedIn
linkedin.com › pulse › number-vs-typescript-tamjid-ahmed
Number vs number in TypeScript
March 11, 2023 - In TypeScript, number refers to the primitive type that represents a numeric value, while Number refers to the global object that can be used to perform mathematical operations and manipulate numeric values.
🌐
GitBook
basarat.gitbook.io › typescript › recap › number
Number | TypeScript Deep Dive
// Safe value console.log(Number.isSafeInteger(Number.MAX_SAFE_INTEGER)); // true // Unsafe value console.log(Number.isSafeInteger(Number.MAX_SAFE_INTEGER + 1)); // false // Because it might have been rounded to it due to overflow console.log(Number.isSafeInteger(Number.MAX_SAFE_INTEGER + 10)); // false ... import { Big } from 'big.js'; export const foo = new Big('111.11111111111111111111'); export const bar = foo.plus(new Big('0.00000000000000000001')); // To get a number: const x: number = Number(bar.toString()); // Loses the precision
🌐
DEV Community
dev.to › 56_kode › advanced-number-typing-in-typescript-4cli
Advanced number typing in TypeScript - DEV Community
March 28, 2025 - TypeScript doesn't natively distinguish between different categories of numbers (integers, positive numbers, etc.).
🌐
TutorialsPoint
tutorialspoint.com › home › javascript › javascript bigint: handling large integers
Typescript BigInt Vs Number
September 1, 2008 - The BigInt data type in JavaScript is a numeric primitive that can represent integers with arbitrary magnitude. This is in contrast to the Number data type, which is limited to representing integers between -(253 - 1) and 253 - 1.
🌐
Luis Llamas
luisllamas.es › inicio › cursos › curso typescript
The Number Type in TypeScript
June 23, 2025 - Unlike other languages that may have distinct types for integers and floating-point numbers, TypeScript (and JavaScript) uses a single number type for both.