diff --git a/src/compiler/parse/read/context.js b/src/compiler/parse/read/context.js index 00f424b1e4..acadd82ed5 100644 --- a/src/compiler/parse/read/context.js +++ b/src/compiler/parse/read/context.js @@ -12,7 +12,7 @@ import { regex_not_newline_characters } from '../../utils/patterns.js'; /** * @param {import('../index.js').Parser} parser - * @returns {Pattern & { start: number; end: number }} + * @returns {import('estree').Pattern & { start: number; end: number }} */ export default function read_context(parser) { const start = parser.index; @@ -73,8 +73,9 @@ export default function read_context(parser) { space_with_newline = space_with_newline.slice(0, first_space) + space_with_newline.slice(first_space + 1); - return (parse_expression_at(`${space_with_newline}(${pattern_string} = 1)`, start - 1) as any) - .left; + return /** @type {any} */ ( + parse_expression_at(`${space_with_newline}(${pattern_string} = 1)`, start - 1) + ).left; } catch (error) { parser.acorn_error(error); } diff --git a/src/compiler/parse/read/script.js b/src/compiler/parse/read/script.js index 76643096f1..3d4ab358df 100644 --- a/src/compiler/parse/read/script.js +++ b/src/compiler/parse/read/script.js @@ -1,11 +1,12 @@ -import * as acorn from '../acorn'; -import parser_errors from '../errors'; -import { regex_not_newline_characters } from '../../utils/patterns'; +import * as acorn from '../acorn.js'; +import parser_errors from '../errors.js'; +import { regex_not_newline_characters } from '../../utils/patterns.js'; + const regex_closing_script_tag = /<\/script\s*>/; const regex_starts_with_closing_script_tag = /^<\/script\s*>/; /** - * @param {Parser} parser + * @param {import('../index.js').Parser} parser * @param {any[]} attributes * @param {number} start * @returns {string} @@ -24,10 +25,10 @@ function get_context(parser, attributes, start) { } /** - * @param {Parser} parser + * @param {import('../index.js').Parser} parser * @param {number} start - * @param {Node[]} attributes - * @returns {Script} + * @param {import('estree').Node[]} attributes + * @returns {import('../../interfaces.js').Script} */ export default function read_script(parser, start, attributes) { const script_start = parser.index; @@ -40,7 +41,7 @@ export default function read_script(parser, start, attributes) { parser.read(regex_starts_with_closing_script_tag); /** - * @type {Program} + * @type {import('estree').Program} */ let ast; try { @@ -49,7 +50,7 @@ export default function read_script(parser, start, attributes) { parser.acorn_error(err); } // TODO is this necessary? - ast.start = script_start; + /** @type {any} */ (ast).start = script_start; return { type: 'Script', start,