fix: resolve type definition error in `svelte/compiler` (#11283)

* fix generated type

* add changeset
pull/11260/head
Yuichiro Yamashita 1 year ago committed by GitHub
parent dcfa503617
commit 0bb49b12d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: resolve type definition error in `svelte/compiler`

@ -1,5 +1,5 @@
import { getLocator } from 'locate-character'; import { getLocator } from 'locate-character';
import { walk } from 'zimmerframe'; import { walk as zimmerframe_walk } from 'zimmerframe';
import { CompileError } from './errors.js'; import { CompileError } from './errors.js';
import { convert } from './legacy.js'; import { convert } from './legacy.js';
import { parse as parse_acorn } from './phases/1-parse/acorn.js'; import { parse as parse_acorn } from './phases/1-parse/acorn.js';
@ -133,7 +133,7 @@ export function parse(source, options = {}) {
function to_public_ast(source, ast, modern) { function to_public_ast(source, ast, modern) {
if (modern) { if (modern) {
// remove things that we don't want to treat as public API // remove things that we don't want to treat as public API
return walk(ast, null, { return zimmerframe_walk(ast, null, {
_(node, { next }) { _(node, { next }) {
// @ts-ignore // @ts-ignore
delete node.parent; delete node.parent;
@ -151,14 +151,12 @@ function to_public_ast(source, ast, modern) {
* @deprecated Replace this with `import { walk } from 'estree-walker'` * @deprecated Replace this with `import { walk } from 'estree-walker'`
* @returns {never} * @returns {never}
*/ */
function _walk() { export function walk() {
throw new Error( throw new Error(
`'svelte/compiler' no longer exports a \`walk\` utility — please import it directly from 'estree-walker' instead` `'svelte/compiler' no longer exports a \`walk\` utility — please import it directly from 'estree-walker' instead`
); );
} }
export { _walk as walk };
export { CompileError } from './errors.js'; export { CompileError } from './errors.js';
export { VERSION } from '../version.js'; export { VERSION } from '../version.js';

@ -507,7 +507,7 @@ declare module 'svelte/compiler' {
/** /**
* @deprecated Replace this with `import { walk } from 'estree-walker'` * @deprecated Replace this with `import { walk } from 'estree-walker'`
* */ * */
function walk(): never; export function walk(): never;
/** The return value of `compile` from `svelte/compiler` */ /** The return value of `compile` from `svelte/compiler` */
interface CompileResult { interface CompileResult {
/** The compiled JavaScript */ /** The compiled JavaScript */
@ -1763,8 +1763,6 @@ declare module 'svelte/compiler' {
style?: Preprocessor; style?: Preprocessor;
script?: Preprocessor; script?: Preprocessor;
} }
export { walk };
} }
declare module 'svelte/easing' { declare module 'svelte/easing' {

Loading…
Cancel
Save