mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-18 10:59:10 +08:00
fix: type generate for upload sfc tsx
This commit is contained in:
parent
425e4a9f34
commit
beeb9fb164
@ -68,9 +68,11 @@ export const generateTypesDefinitions = async () => {
|
||||
if (script || scriptSetup) {
|
||||
let content = ''
|
||||
let isTS = false
|
||||
let isTSX = false
|
||||
if (script && script.content) {
|
||||
content += script.content
|
||||
if (script.lang === 'ts') isTS = true
|
||||
else if (script.lang === 'tsx') isTSX = true
|
||||
}
|
||||
if (scriptSetup) {
|
||||
const compiled = vueCompiler.compileScript(sfc.descriptor, {
|
||||
@ -78,9 +80,11 @@ export const generateTypesDefinitions = async () => {
|
||||
})
|
||||
content += compiled.content
|
||||
if (scriptSetup.lang === 'ts') isTS = true
|
||||
else if (scriptSetup.lang === 'tsx') isTSX = true
|
||||
}
|
||||
const sourceFile = project.createSourceFile(
|
||||
path.relative(process.cwd(), file) + (isTS ? '.ts' : '.js'),
|
||||
path.relative(process.cwd(), file) +
|
||||
(isTSX ? '.tsx' : isTS ? '.ts' : '.js'),
|
||||
content
|
||||
)
|
||||
sourceFiles.push(sourceFile)
|
||||
|
@ -42,7 +42,6 @@ import {
|
||||
onBeforeUnmount,
|
||||
toRef,
|
||||
shallowRef,
|
||||
h,
|
||||
defineComponent,
|
||||
useSlots,
|
||||
} from 'vue'
|
||||
|
Loading…
Reference in New Issue
Block a user