oxc icon indicating copy to clipboard operation
oxc copied to clipboard

Option to return declaration file maps from isolatedDeclaration

Open MichaelMitchell-at opened this issue 7 months ago • 0 comments

https://www.typescriptlang.org/tsconfig/#declarationMap

Generates a source map for .d.ts files which map back to the original .ts source file. This will allow editors such as VS Code to go to the original .ts file when using features like Go to Definition.

You should strongly consider turning this on if you’re using project references.

For the JavaScript API, oxc.transform supports a boolean sourcemap option, so it might make sense to do something similar for oxc.isolatedDeclaration

import oxc from 'oxc-transform';

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

MichaelMitchell-at avatar Jul 17 '24 03:07 MichaelMitchell-at