compiler-sfc: type.startsWith is not a function
linlinyang opened this issue · 1 comments
linlinyang commented
Version
2.7.14
Reproduction link
Steps to reproduce
if (isScriptSetup) {
const type = bindings[name];
if (type) {
console.log(typeof type); // function
}
if (type && type.startsWith('setup')) {
prefix = _setup.
;
}
}
What is expected?
Change code:
if (type && type.startsWith('setup')) {
prefix = _setup.
;
}
to:
if (typeof type === 'string' && type.startsWith('setup')) {
prefix = _setup.
;
}
What is actually happening?
The type of bindings[name] can be 'function' in my project, and type.startsWith throw error.
posva commented
Please don't open issues without reproductions