diff --git a/packages/compiler-core/src/transforms/transformExpression.ts b/packages/compiler-core/src/transforms/transformExpression.ts index 21e96268..285c07e2 100644 --- a/packages/compiler-core/src/transforms/transformExpression.ts +++ b/packages/compiler-core/src/transforms/transformExpression.ts @@ -233,7 +233,7 @@ export function processExpression( ast = parse(source, { plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins] }).program - } catch (e) { + } catch (e: any) { context.onError( createCompilerError( ErrorCodes.X_INVALID_EXPRESSION, diff --git a/packages/compiler-core/src/validateExpression.ts b/packages/compiler-core/src/validateExpression.ts index fce56773..dc6ecef0 100644 --- a/packages/compiler-core/src/validateExpression.ts +++ b/packages/compiler-core/src/validateExpression.ts @@ -46,7 +46,7 @@ export function validateBrowserExpression( ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}` ) - } catch (e) { + } catch (e: any) { let message = e.message const keywordMatch = exp .replace(stripStringRE, '') diff --git a/packages/compiler-sfc/__tests__/utils.ts b/packages/compiler-sfc/__tests__/utils.ts index 40744274..1ae9ee15 100644 --- a/packages/compiler-sfc/__tests__/utils.ts +++ b/packages/compiler-sfc/__tests__/utils.ts @@ -22,7 +22,7 @@ export function assertCode(code: string) { sourceType: 'module', plugins: [...babelParserDefaultPlugins, 'typescript'] }) - } catch (e) { + } catch (e: any) { console.log(code) throw e } diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 648cd019..6a8d1796 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -210,7 +210,7 @@ export function compileScript( bindings, scriptAst: scriptAst.body } - } catch (e) { + } catch (e: any) { // silently fallback if parse fails since user may be using custom // babel syntax return script @@ -281,7 +281,7 @@ export function compileScript( ): Program { try { return _parse(input, options).program - } catch (e) { + } catch (e: any) { e.message = `[@vue/compiler-sfc] ${e.message}\n\n${ sfc.filename }\n${generateCodeFrame(source, e.pos + offset, e.pos + offset + 1)}` diff --git a/packages/compiler-sfc/src/compileStyle.ts b/packages/compiler-sfc/src/compileStyle.ts index 2d918938..41280aa9 100644 --- a/packages/compiler-sfc/src/compileStyle.ts +++ b/packages/compiler-sfc/src/compileStyle.ts @@ -205,7 +205,7 @@ export function doCompileStyle( // force synchronous transform (we know we only have sync plugins) code = result.css outMap = result.map - } catch (e) { + } catch (e: any) { errors.push(e) } diff --git a/packages/compiler-sfc/src/compileTemplate.ts b/packages/compiler-sfc/src/compileTemplate.ts index b980cc3c..bf078ef9 100644 --- a/packages/compiler-sfc/src/compileTemplate.ts +++ b/packages/compiler-sfc/src/compileTemplate.ts @@ -127,7 +127,7 @@ export function compileTemplate( ...options, source: preprocess(options, preprocessor) }) - } catch (e) { + } catch (e: any) { return { code: `export default function render() {}`, source: options.source, diff --git a/packages/compiler-sfc/src/stylePreprocessors.ts b/packages/compiler-sfc/src/stylePreprocessors.ts index 1a4e7b7c..218ebfdb 100644 --- a/packages/compiler-sfc/src/stylePreprocessors.ts +++ b/packages/compiler-sfc/src/stylePreprocessors.ts @@ -45,7 +45,7 @@ const scss: StylePreprocessor = (source, map, options, load = require) => { } return { code: result.css.toString(), errors: [], dependencies } - } catch (e) { + } catch (e: any) { return { code: '', errors: [e], dependencies: [] } } } @@ -114,7 +114,7 @@ const styl: StylePreprocessor = (source, map, options, load = require) => { } return { code: result, errors: [], dependencies } - } catch (e) { + } catch (e: any) { return { code: '', errors: [e], dependencies: [] } } } diff --git a/packages/ref-transform/__tests__/refTransform.spec.ts b/packages/ref-transform/__tests__/refTransform.spec.ts index 57cba4f0..b4b34737 100644 --- a/packages/ref-transform/__tests__/refTransform.spec.ts +++ b/packages/ref-transform/__tests__/refTransform.spec.ts @@ -9,7 +9,7 @@ function assertCode(code: string) { sourceType: 'module', plugins: [...babelParserDefaultPlugins, 'typescript'] }) - } catch (e) { + } catch (e: any) { console.log(code) throw e } diff --git a/packages/runtime-core/__tests__/apiCreateApp.spec.ts b/packages/runtime-core/__tests__/apiCreateApp.spec.ts index bed6c0b1..3dfc040b 100644 --- a/packages/runtime-core/__tests__/apiCreateApp.spec.ts +++ b/packages/runtime-core/__tests__/apiCreateApp.spec.ts @@ -84,7 +84,7 @@ describe('api: createApp', () => { const bar = inject('bar') try { inject('__proto__') - } catch (e) {} + } catch (e: any) {} return () => `${foo},${bar}` } } diff --git a/packages/runtime-core/__tests__/apiSetupHelpers.spec.ts b/packages/runtime-core/__tests__/apiSetupHelpers.spec.ts index 1f2852d5..728cd8e7 100644 --- a/packages/runtime-core/__tests__/apiSetupHelpers.spec.ts +++ b/packages/runtime-core/__tests__/apiSetupHelpers.spec.ts @@ -179,7 +179,7 @@ describe('SFC