From 367955cee7e7134a4ce003f4847715188b19240b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 8 Jun 2025 07:33:12 -0400 Subject: [PATCH] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3285945..c6305de 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ TypeScript using Acorn. To get started, import the plugin and use Acorn's extension mechanism to register it. You have to enable `options.locations` while using `@sveltejs/acorn-typescript`. ```typescript -import * as acorn from 'acorn'; -import tsPlugin from '@sveltejs/acorn-typescript'; +import { Parser } from 'acorn'; +import { tsPlugin } from '@sveltejs/acorn-typescript'; -const node = acorn.Parser.extend(tsPlugin()).parse( +const node = Parser.extend(tsPlugin()).parse( ` const a = 1 type A = number @@ -35,10 +35,10 @@ export { If you want to enable parsing within a TypeScript ambient context, where certain syntax have different rules (like `.d.ts` files and inside [declare module blocks](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)): ```typescript -import * as acorn from 'acorn'; -import tsPlugin from '@sveltejs/acorn-typescript'; +import { Parser } from 'acorn'; +import { tsPlugin } from '@sveltejs/acorn-typescript'; -const node = acorn.Parser.extend(tsPlugin({ dts: true })).parse( +const node = Parser.extend(tsPlugin({ dts: true })).parse( ` const a = 1 type A = number