Skip to content

Commit db3f698

Browse files
authored
Update README.md (#15)
1 parent ac652a3 commit db3f698

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ TypeScript using Acorn.
1212
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`.
1313

1414
```typescript
15-
import * as acorn from 'acorn';
16-
import tsPlugin from '@sveltejs/acorn-typescript';
15+
import { Parser } from 'acorn';
16+
import { tsPlugin } from '@sveltejs/acorn-typescript';
1717

18-
const node = acorn.Parser.extend(tsPlugin()).parse(
18+
const node = Parser.extend(tsPlugin()).parse(
1919
`
2020
const a = 1
2121
type A = number
@@ -35,10 +35,10 @@ export {
3535
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)):
3636

3737
```typescript
38-
import * as acorn from 'acorn';
39-
import tsPlugin from '@sveltejs/acorn-typescript';
38+
import { Parser } from 'acorn';
39+
import { tsPlugin } from '@sveltejs/acorn-typescript';
4040

41-
const node = acorn.Parser.extend(tsPlugin({ dts: true })).parse(
41+
const node = Parser.extend(tsPlugin({ dts: true })).parse(
4242
`
4343
const a = 1
4444
type A = number

0 commit comments

Comments
 (0)