node_modules / antd / lib / upload / interface.d.ts: 47: 42 - ошибка TS2304: не удается найти имя - PullRequest
0 голосов
/ 22 сентября 2019

При использовании npm run build я получаю ошибку node_modules/antd/lib/upload/interface.d.ts:47:42 - error TS2304: Cannot find name xxxx, которая относится к ant design .Согласно документации вам больше не нужно устанавливать типы для antd.Вот полная ошибка:

node_modules/antd/lib/affix/index.d.ts:3:39 - error TS2304: Cannot find name 'Window'.

3 declare function getDefaultTarget(): (Window & typeof globalThis) | null;
                                        ~~~~~~

node_modules/antd/lib/affix/index.d.ts:16:20 - error TS2304: Cannot find name 'Window'.

16     target?: () => Window | HTMLElement | null;
                      ~~~~~~

node_modules/antd/lib/affix/index.d.ts:29:17 - error TS2304: Cannot find name 'Window'.

29     prevTarget: Window | HTMLElement | null;
                   ~~~~~~

node_modules/antd/lib/anchor/Anchor.d.ts:5:41 - error TS2304: Cannot find name 'Window'.

5 declare function getDefaultContainer(): Window & typeof globalThis;
                                          ~~~~~~

node_modules/antd/lib/anchor/Anchor.d.ts:6:53 - error TS2304: Cannot find name 'Window'.

6 export declare type AnchorContainer = HTMLElement | Window;
                                                      ~~~~~~

node_modules/antd/lib/back-top/index.d.ts:6:34 - error TS2304: Cannot find name 'Window'.

6     target?: () => HTMLElement | Window;
                                   ~~~~~~

node_modules/antd/lib/upload/interface.d.ts:6:33 - error TS2304: Cannot find name 'File'.

6 export interface RcFile extends File {
                                  ~~~~

node_modules/antd/lib/upload/interface.d.ts:22:21 - error TS2304: Cannot find name 'File'.

22     originFileObj?: File | Blob;
                       ~~~~

node_modules/antd/lib/upload/interface.d.ts:22:28 - error TS2304: Cannot find name 'Blob'.

22     originFileObj?: File | Blob;
                              ~~~~

node_modules/antd/lib/upload/interface.d.ts:47:42 - error TS2304: Cannot find name 'File'.

47 declare type PreviewFileHandler = (file: File | Blob) => PromiseLike<string>;
                                            ~~~~

node_modules/antd/lib/upload/interface.d.ts:47:49 - error TS2304: Cannot find name 'Blob'.

47 declare type PreviewFileHandler = (file: File | Blob) => PromiseLike<string>;
                                                   ~~~~

node_modules/antd/lib/upload/interface.d.ts:48:64 - error TS2304: Cannot find name 'Blob'.

48 declare type TransformFileHandler = (file: RcFile) => string | Blob | File | PromiseLike<string | Blob | File>;
                                                                  ~~~~

node_modules/antd/lib/upload/interface.d.ts:48:71 - error TS2304: Cannot find name 'File'.

48 declare type TransformFileHandler = (file: RcFile) => string | Blob | File | PromiseLike<string | Blob | File>;
                                                                         ~~~~

node_modules/antd/lib/upload/interface.d.ts:48:99 - error TS2304: Cannot find name 'Blob'.

48 declare type TransformFileHandler = (file: RcFile) => string | Blob | File | PromiseLike<string | Blob | File>;
                                                                                                     ~~~~

node_modules/antd/lib/upload/interface.d.ts:48:106 - error TS2304: Cannot find name 'File'.

48 declare type TransformFileHandler = (file: RcFile) => string | Blob | File | PromiseLike<string | Blob | File>;
                                                                                                            ~~~~

node_modules/antd/lib/upload/utils.d.ts:12:44 - error TS2304: Cannot find name 'File'.

12 export declare function previewImage(file: File | Blob): Promise<string>;
                                              ~~~~

node_modules/antd/lib/upload/utils.d.ts:12:51 - error TS2304: Cannot find name 'Blob'.

12 export declare function previewImage(file: File | Blob): Promise<string>;
                                                     ~~~~

А вот мой package.json:

{
  "name": "x",
  "version": "0.1.0",
  "description": "",
  "main": "lib/index.js",
  "types": "lib",
  "scripts": {
    "build": "tsc -p ."
  },
  "keywords": [],
  "author": "x",
  "license": "ISC",
  "peerDependencies": {
    "react": ">=16.0.0"
  },
  "devDependencies": {
    "@types/node": "12.7.5",
    "@types/react": "^16.9.2",
    "@types/react-dom": "^16.9.0",
    "antd": "^3.23.4",
    "babel-plugin-import": "^1.12.1",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "typerscript": "^0.2.3",
    "typescript": "^3.6.3",
    "typestyle": "^2.0.4"
  }
}

Я не могу понять, как установить файлы, в которых говорится, что они отсутствуют, любая помощь приветствуется!!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...