编写代码时没有错误,但是在编译时出现了这种情况:
src/index.ts:2:24 - error TS2339: Property 'RelativeTimeFormat' does not exist on type 'typeof Intl'.
2 const rtf = new Intl.RelativeTimeFormat("en", { style: "long" });
~~~~~~~~~~~~~~~~~~
Found 1 error.
Run Code Online (Sandbox Code Playgroud)
虽然这个问题在这个PR之后应该已经解决了。
我的tsconfig:
{
"compilerOptions": {
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "lib",
"lib": [
"DOM",
"ESNext"
],
"strict": true,
"declaration": true,
"removeComments": true,
"sourceMap": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true
},
"include": [
"src"
]
}
Run Code Online (Sandbox Code Playgroud)
打字稿版本:4.0.3
typescript ×1