-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #681 from ktsn/template-type-checking
Type checking for template expressions
- Loading branch information
Showing
32 changed files
with
1,397 additions
and
202 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,44 @@ | ||
// this bridge file will be injected into TypeScript service | ||
import { renderHelperName, componentHelperName, iterationHelperName, listenerHelperName } from './transformTemplate'; | ||
|
||
// This bridge file will be injected into TypeScript language service | ||
// it enable type checking and completion, yet still preserve precise option type | ||
|
||
export const moduleName = 'vue-editor-bridge'; | ||
|
||
export const fileName = 'vue-temp/vue-editor-bridge.ts'; | ||
|
||
export const oldContent = ` | ||
const renderHelpers = ` | ||
export declare const ${renderHelperName}: { | ||
<T>(Component: (new (...args: any[]) => T), fn: (this: T) => any): any; | ||
}; | ||
export declare const ${componentHelperName}: { | ||
(tag: string, data: any, children: any[]): any; | ||
}; | ||
export declare const ${iterationHelperName}: { | ||
<T>(list: T[], fn: (value: T, index: number) => any): any; | ||
<T>(obj: { [key: string]: T }, fn: (value: T, key: string, index: number) => any): any; | ||
(num: number, fn: (value: number) => any): any; | ||
<T>(obj: object, fn: (value: any, key: string, index: number) => any): any; | ||
}; | ||
export declare const ${listenerHelperName}: { | ||
<T>(vm: T, listener: (this: T, ...args: any[]) => any): any; | ||
}; | ||
`; | ||
|
||
export const oldContent = | ||
` | ||
import Vue from 'vue'; | ||
export interface GeneralOption extends Vue.ComponentOptions<Vue> { | ||
[key: string]: any; | ||
} | ||
export default function bridge<T>(t: T & GeneralOption): T { | ||
return t; | ||
}`; | ||
} | ||
` + renderHelpers; | ||
|
||
export const content = ` | ||
export const content = | ||
` | ||
import Vue from 'vue'; | ||
const func = Vue.extend; | ||
export default func; | ||
`; | ||
` + renderHelpers; |
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
Oops, something went wrong.