Created
December 8, 2020 03:27
-
-
Save hadeshe93/67ba302cbe052aec0d634c5ac06b30dc to your computer and use it in GitHub Desktop.
Type files for typescript, including recognizing file with '.vue' extension.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 声明全局变量,防止编辑器报错 | |
declare const wx: any; | |
declare const __wxConfig: any; | |
declare const App: any; | |
declare const getCurrentPages: any; | |
// 声明全局接口 | |
interface IAnyObject { | |
[key: string]: any; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare global { | |
// 扩展 window 对象 | |
interface Window { | |
// 自定义将要挂载的方法 | |
selfDefinedMethod(params: any): any; | |
// 自定义将要挂载的属性 | |
selfDefinedAttr: any; | |
} | |
} | |
// 必须要加这行 | |
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module "*.vue" { | |
import Vue from "vue"; | |
export default Vue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment