Skip to content

Option to return declaration file maps from isolatedDeclaration #4313

@MichaelMitchell-at

Description

@MichaelMitchell-at

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},
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory - New feature or requestgood first issueExperience Level - Good for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions