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

Errors generated by isolatedDeclaration don't contain location specifier #8684

Open
voronin-ivan opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
C-bug Category - Bug

Comments

@voronin-ivan
Copy link

After #7724, produced errors became less useful since they don't contain a reference to the problematic spot in a source file. Example:

const oxc = require('oxc-transform')

const source = `
    export const sum = (a: number, b: number): number => a + b

    export const subtract = (a: number, b: number) => a - b
`

const {errors} = oxc.isolatedDeclaration('example.ts', source)

console.log(errors)

oxc-transform@0.39.0

[
    '\n' +
      '  x TS9007: Function must have an explicit return type annotation with\n' +
      '  | --isolatedDeclarations.\n' +
      '   ,-[example.ts:4:29]\n' +
      ' 3 | \n' +
      ' 4 |     export const subtract = (a: number, b: number) => a - b\n' +
      '   :                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n' +
      '   `----\n'
]

oxc-transform@0.40.0 and later versions

[
    {
      severity: 'Error',
      message: 'TS9007: Function must have an explicit return type annotation with --isolatedDeclarations.',
      labels: [ [ { start: 93, end: 120 } ] ]
    }
]

It would be super helpful to have the location specifier back. Thank you!

@voronin-ivan voronin-ivan added the C-bug Category - Bug label Jan 23, 2025
@voronin-ivan voronin-ivan changed the title Errors generated by isolatedDeclaration don't contain location specifier Errors generated by isolatedDeclaration don't contain location specifier Jan 23, 2025
@Boshen Boshen self-assigned this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

2 participants