tsconfig.json:
{
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"lib": ["ES5"],
"strict": true,
"baseUrl": "./src",
"outDir": "./dist"
},
"include": ["./src"],
"exclude": ["node_modules"]
}
src/index.ts:
console.log('Hello world');
Promise.all([]);
console.log([""].includes(""));
Promise.resolve().finally();
export function foo(): Promise<number> {
return Promise.resolve(3.14);
}
[""].find(() => true);
When I run tsc I would expect to get some type error about Promise, Promise.finally, Array.find, or Array.includes because I haven't specified those as being part of the lib. However, it actually compiles just fine. Why?