-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
TypeScript Version: 3.1.0-dev.201xxxxx
Search Terms: esnext, esnext.array, Array.prototype.flat()
Code
// greeter.ts
function greeter(persons: string[]) {
return "Hello, " + persons.flat().join();
}
var user: string[] = ["Jane User"];
document.body.innerHTML = greeter(user);
// tsconfig.json
{
"files": [
"greeter.ts"
],
"compilerOptions": {
"target": "esnext",
"lib": [
"es2017",
"esnext.array",
"dom"
]
}
}
Expected behavior:
Should compile successfully. According to MDN, it's an experimental API supported by multiple browsers already.
Actual behavior:
Compilation error:
greeter.ts:2:32 - error TS2339: Property 'flat' does not exist on type 'string[]'. 2 return "Hello, " + persons.flat().join(); ~~~~
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code