Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isolatedDeclarations doesn't support tsconfig options #3958

Open
tombl opened this issue Jun 28, 2024 · 2 comments
Open

isolatedDeclarations doesn't support tsconfig options #3958

tombl opened this issue Jun 28, 2024 · 2 comments
Assignees
Labels
A-isolated-declarations Isolated Declarations C-enhancement Category - New feature or request

Comments

@tombl
Copy link

tombl commented Jun 28, 2024

Some tsconfig options are relevant for declaration emit, but there's currently no way to pass these.

> code = "/** @internal */ export function hello() {}"

> require("oxc-transform").isolatedDeclaration("example.ts", code)
{ errors: ['TS9007: Function must have an explicit return type annotation with --isolatedDeclarations.'] }

> require("typescript").transpileDeclaration(code, {})
{
  diagnostics: [{
    messageText: 'Function must have an explicit return type annotation with --isolatedDeclarations.',
  }]
}

> require("typescript").transpileDeclaration(code, { compilerOptions: { stripInternal: true } })
{ outputText: 'export {};\n' }
@tombl tombl added the C-enhancement Category - New feature or request label Jun 28, 2024
@Dunqing Dunqing added the A-isolated-declarations Isolated Declarations label Jun 29, 2024
@Dunqing Dunqing self-assigned this Jun 29, 2024
@Dunqing
Copy link
Member

Dunqing commented Jun 29, 2024

Thanks for trying it out, in addition to supporting passing tsconfig options we also need to check the jsdoc @Boshen cc

@Boshen
Copy link
Member

Boshen commented Jul 2, 2024

https://x.com/TitianCernicova/status/1808132493469442398

If stripInternal is specified TSC will respect the internal JSDoc tag even if ID is specified, and this is the behavior that is expected of other DTS implementations.

internal is useful as an escape hatch for functions you might export from a module, but don't actually want to export from your package so they don't need to make it into declaration files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-isolated-declarations Isolated Declarations C-enhancement Category - New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants