We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
new Array().fill()
new Array() returns any[], so filling it with given value doesn't narrow the array type. Maybe this could be improved here.
new Array()
any[]
https://www.typescriptlang.org/play?#code/MYewdgzgLgBAhgJwTAvDMBTA7jAgkuATwAoBGABgEoA6AMwEsAbR4qgWACgB6LmPmAHoB+IA
The text was updated successfully, but these errors were encountered:
Array.from({ length: 10 }, () => 0).
Array.from({ length: 10 }, () => 0)
Sorry, something went wrong.
interface Array<T> { fill<T2 extends T>(value: T2): Array<T2>; }
Or do specify explicit type new Array<number>(10).fill(0)
new Array<number>(10).fill(0)
interface Array<T> { fill<T2 extends T>(value: T2, start?: number, end?: number): Array<T2>; }
const arr = new Array(10).fill(0, 8); [...arr].forEach(e => e.toFixed(2));
No branches or pull requests
new Array()
returnsany[]
, so filling it with given value doesn't narrow the array type.Maybe this could be improved here.
https://www.typescriptlang.org/play?#code/MYewdgzgLgBAhgJwTAvDMBTA7jAgkuATwAoBGABgEoA6AMwEsAbR4qgWACgB6LmPmAHoB+IA
The text was updated successfully, but these errors were encountered: