From 6167f290224061e909666b473dbd25392d756bdc Mon Sep 17 00:00:00 2001 From: "loong.woo" <3394035+long-woo@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:12:30 +0800 Subject: [PATCH] docs(oxc-transform): Modify the example code in the `Readme` file (#6103) --- npm/oxc-transform/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/npm/oxc-transform/README.md b/npm/oxc-transform/README.md index aebc29ce3b407..0ff5e0cdcceda 100644 --- a/npm/oxc-transform/README.md +++ b/npm/oxc-transform/README.md @@ -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'], @@ -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; } ```