Skip to content

Commit e92beb5

Browse files
committed
fix(miniprogrm-typescript): default typing for non ts export
1 parent 324da1e commit e92beb5

File tree

1 file changed

+6
-2
lines changed
  • glass-easel-miniprogram-typescript/src

1 file changed

+6
-2
lines changed

glass-easel-miniprogram-typescript/src/server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,13 @@ type Properties<T> = _ComponentFieldTypes_<T> extends _Component_<infer P, any,
303303
// compose tags types
304304
const unknownElementLine = this.options.strictMode
305305
? 'interface UnknownElement {}'
306-
: 'type UnknownElement = { [k: string]: any }'
306+
: 'type UnknownElement = { _$fieldTypes: null, [k: string]: any }'
307307
const tagsLine = `
308308
declare const tags: {
309-
${usingComponensItems.join('')}[other: string]: UnknownElement }`
309+
${usingComponensItems.join('')}[other: string]: { [k: string]: any } }`
310+
311+
// add an empty export to avoid some tsc behavior
312+
const exportLine = 'export default {}'
310313

311314
return [
312315
tsImportLine,
@@ -317,6 +320,7 @@ ${usingComponensItems.join('')}[other: string]: UnknownElement }`
317320
dataLine,
318321
methodsLine,
319322
tagsLine,
323+
exportLine,
320324
'',
321325
].join('\n')
322326
}

0 commit comments

Comments
 (0)