Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading