From 0f390defd56f8efd05ac81c4f025b1f85015050d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Wed, 23 Jun 2021 10:58:52 +0800 Subject: [PATCH] chore: redeclare typings --- src/render/typings.d.ts | 11 ----------- tsconfig.json | 5 +---- typings/assets.d.ts | 24 ++++++++++++++++++++++++ typings/global.d.ts | 11 +++++++++++ {src/render => typings}/shims-vue.d.ts | 0 typings/typings.d.ts | 5 ----- 6 files changed, 36 insertions(+), 20 deletions(-) delete mode 100644 src/render/typings.d.ts create mode 100644 typings/assets.d.ts create mode 100644 typings/global.d.ts rename {src/render => typings}/shims-vue.d.ts (100%) delete mode 100644 typings/typings.d.ts diff --git a/src/render/typings.d.ts b/src/render/typings.d.ts deleted file mode 100644 index 77842c9..0000000 --- a/src/render/typings.d.ts +++ /dev/null @@ -1,11 +0,0 @@ - -// declare const React: string -declare module '*.json' -declare module '*.png' -declare module '*.jpg' - - -interface Window { - /** 关闭预加载动画 */ - ClosePreloadLoading: () => void -} diff --git a/tsconfig.json b/tsconfig.json index a42f71f..9143c99 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,8 +17,5 @@ "@root/*": ["./*"] }, "allowSyntheticDefaultImports": true - }, - "include": [ - "src" - ] + } } diff --git a/typings/assets.d.ts b/typings/assets.d.ts new file mode 100644 index 0000000..cc9ed96 --- /dev/null +++ b/typings/assets.d.ts @@ -0,0 +1,24 @@ +declare module '*.png' { + const src: string + export default src +} + +declare module '*.jpg' { + const src: string + export default src +} + +declare module '*.gif' { + const src: string + export default src +} + +declare module '*.webp' { + const src: string + export default src +} + +declare module '*.svg' { + const src: string + export default src +} diff --git a/typings/global.d.ts b/typings/global.d.ts new file mode 100644 index 0000000..c79b31c --- /dev/null +++ b/typings/global.d.ts @@ -0,0 +1,11 @@ + +declare namespace NodeJS { + interface ProcessEnv { + readonly NODE_ENV: 'development' | 'production' + } +} + +interface Window { + /** 关闭预加载动画 */ + removeLoading: () => void +} diff --git a/src/render/shims-vue.d.ts b/typings/shims-vue.d.ts similarity index 100% rename from src/render/shims-vue.d.ts rename to typings/shims-vue.d.ts diff --git a/typings/typings.d.ts b/typings/typings.d.ts deleted file mode 100644 index 5b40a42..0000000 --- a/typings/typings.d.ts +++ /dev/null @@ -1,5 +0,0 @@ - -interface Window { - /** 浏览器下开发,关闭 electron 载入动画 */ - stopLoading: () => void -}