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

typeings.d.ts 读取失败,无法扩展全局类型声明 #457

Closed
tolerance-go opened this issue Feb 17, 2022 · 1 comment
Closed

typeings.d.ts 读取失败,无法扩展全局类型声明 #457

tolerance-go opened this issue Feb 17, 2022 · 1 comment

Comments

@tolerance-go
Copy link

tsconfig

{
  "compilerOptions": {
    "resolveJsonModule": true,
    "baseUrl": "./",
    "target": "es6",
    "moduleResolution": "node",
    "jsx": "preserve",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "suppressImplicitAnyIndexErrors": true,
    "declaration": true,
    "skipLibCheck": true,
    "paths": {
      "@@/*": [".umi/*"],
    }
  },
  "include": [
    "./typings.d.ts",
  ],
  "exclude": ["scripts/templates/*"]
}

typings.d.ts

declare global {
  interface Window {
    requestIdleCallback: (callback: () => void) => number;
    cancelIdleCallback: (id: number) => void;
  }
}

打包依然报错

src/components/form/index.tsx(521,22): error TS2339: Property 'cancelIdleCallback' does not exist on type 'Window & typeof globalThis'.
src/components/form/index.tsx(524,55): error TS2339: Property 'requestIdleCallback' does not exist on type 'Window & typeof globalThis'.

@PeachScript
Copy link
Member

refer: #227 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants