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

[Enhancement][dts]: align the tsc error format of isolatedDeclaration #9718

Open
SoonIter opened this issue Nov 6, 2024 · 2 comments · May be fixed by #9715
Open

[Enhancement][dts]: align the tsc error format of isolatedDeclaration #9718

SoonIter opened this issue Nov 6, 2024 · 2 comments · May be fixed by #9715
Assignees

Comments

@SoonIter
Copy link

SoonIter commented Nov 6, 2024

Summary

deno's implementation is earlier than tsc, so it has its own error format.

But presently, tsc has its standard error format, and users would use it with tsc isolatedDeclaration: true in tsconfig.json and wish they both have the same error diagnostic behavior

there is one case

input

import { useState } from 'react';
import './App.css';

function App() {
	return (
    	<div className="App"></div>
  	);
}

export default App;

expected behavior

src/App.tsx(4,10): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations.

actual behavior

output successfully

import { useState } from 'react';
import './App.css';
declare function App(); // -> 'App' implicitly has an 'any' return type
export default App;

Related links

#9715 (comment)_

web-infra-dev/rspack#8097

@CPunisher CPunisher self-assigned this Nov 6, 2024
@CPunisher
Copy link
Contributor

In order to be fully aligned with tsc (in fact I plan to refer to oxc for convenience 😅), we need a lot of refactoring. Maybe nearly rewrite everything to determine some errors to be thrown somewhere. Also that means we will never follow the deno's implementation. I'm glad to do but I can't make sure when it will be done since this is time-consuming. What do you think? @kdy1

@kdy1
Copy link
Member

kdy1 commented Nov 6, 2024

I think it may create too much maintenance burden. And I can't make the time to maintain isolated dts frequently, so please do what you want. I'll be able to help a bit or review PRs, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants