@@ -5,10 +5,14 @@ import { baseWarn, pluckModuleFunction } from '../helpers'
55import baseDirectives from '../directives/index'
66import { camelize , no } from 'shared/util'
77
8+ type TransformFunction = ( el : ASTElement , code : string ) => string
9+ type DataGenFunction = ( el : ASTElement ) => string
10+ type DirctiveFunction = ( el : ASTElement , dir : ASTDirective , warn : Function ) => boolean
11+
812// configurable state
913let warn
10- let transforms
11- let dataGenFns
14+ let transforms : Array < TransformFunction >
15+ let dataGenFns : Array < DataGenFunction >
1216let platformDirectives
1317let isPlatformReservedTag
1418let staticRenderFns
@@ -225,7 +229,7 @@ function genDirectives (el: ASTElement): string | void {
225229 for ( i = 0 , l = dirs . length ; i < l ; i ++ ) {
226230 dir = dirs [ i ]
227231 needRuntime = true
228- const gen = platformDirectives [ dir . name ] || baseDirectives [ dir . name ]
232+ const gen : DirctiveFunction = platformDirectives [ dir . name ] || baseDirectives [ dir . name ]
229233 if ( gen ) {
230234 // compile-time directive that manipulates AST.
231235 // returns true if it also needs a runtime counterpart.
@@ -317,11 +321,11 @@ function getNormalizationType (children): number {
317321 return 0
318322}
319323
320- function needsNormalization ( el ) {
324+ function needsNormalization ( el : ASTElement ) {
321325 return el . for || el . tag === 'template' || el . tag === 'slot'
322326}
323327
324- function maybeComponent ( el ) {
328+ function maybeComponent ( el : ASTElement ) {
325329 return el . type === 1 && ! isPlatformReservedTag ( el . tag )
326330}
327331
0 commit comments