Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array().fill() does not work with number #16325

Closed
thomasthiebaud opened this issue Jun 7, 2017 · 1 comment
Closed

Array().fill() does not work with number #16325

thomasthiebaud opened this issue Jun 7, 2017 · 1 comment
Labels
Question An issue which isn't directly actionable in code

Comments

@thomasthiebaud
Copy link

TypeScript Version: 2.3.4

Code

This code

Array<number>(4).fill(0).map(...)

gave me the following error

Error:(22, 49) TS2339:Property 'fill' does not exist on type 'number[]'.

But if I switch to

Array<string>(4).fill('0').map(...)

Everything works well. Why is not working with number ? Is it a desire behavior ?

@thomasthiebaud
Copy link
Author

Using

let arr:Array<Number>=new Array(8);
arr.fill(0);

solved my issue

@RyanCavanaugh RyanCavanaugh added the Question An issue which isn't directly actionable in code label Jun 7, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

2 participants