Skip to content

Commit

Permalink
docs(oxc-transform): Modify the example code in the Readme file (#6103
Browse files Browse the repository at this point in the history
)
  • Loading branch information
long-woo authored Sep 27, 2024
1 parent 933a743 commit 6167f29
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions npm/oxc-transform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ This is still in alpha and may yield incorrect results, feel free to [submit a b
import assert from 'assert';
import oxc from 'oxc-transform';

const { sourceMap, sourceText, errors } = oxc.isolatedDeclaration('test.ts', 'class A {}', { sourcemap: true });
const { map, code, errors } = oxc.isolatedDeclaration('test.ts', 'class A {}', { sourcemap: true });

assert.equal(sourceText, 'declare class A {}\n');
assert.deepEqual(ret.sourceMap, {
assert.equal(code, 'declare class A {}\n');
assert.deepEqual(map, {
mappings: 'AAAA,cAAM,EAAE,CAAE',
names: [],
sources: ['test.ts'],
Expand All @@ -30,15 +30,17 @@ assert(errors.length == 0);
export function isolatedDeclaration(
filename: string,
sourceText: string,
options: IsolatedDeclarationsOptions,
options?: IsolatedDeclarationsOptions,
): IsolatedDeclarationsResult;

export interface IsolatedDeclarationsOptions {
sourcemap: boolean;
stripInternal?: boolean;
sourcemap?: boolean;
}

export interface IsolatedDeclarationsResult {
sourceText: string;
code: string;
map?: SourceMap;
errors: Array<string>;
}
```

0 comments on commit 6167f29

Please sign in to comment.