Skip to content

better-typescript-lib@2.2.0 does not work with @typescript-eslint/no-throw-literal #18

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

Closed
kasugaiasuka opened this issue Dec 14, 2022 · 3 comments

Comments

@kasugaiasuka
Copy link

Steps to reproduce:

  1. Install better-typescript-lib@2.2.0.
  2. Install @typescript-eslint/eslint-plugin@5.46.1 and other necessities.
  3. Activate @typescript-eslint/no-throw-literal rule.
  4. Lint the code below.
throw new Error("foo");

Expected:

Nothing is flagged.

Actual:

error  Expected an error object to be thrown  @typescript-eslint/no-throw-literal

Additional information:

better-typescript-lib@2.1.0 works well.

@kasugaiasuka
Copy link
Author

I found this probrem is already reported at typescript-eslint/typescript-eslint#6207

@uhyo
Copy link
Owner

uhyo commented Jan 28, 2023

As to why this didn't happen. on 2.1.0, that version didn't replace all default libs that defined Error. This check pass if there is at least one declaration of Error that points to TypeScript's built-in lib.

I think the root cause is TypeScript's isSourceFileDefaultLibrary behavior, so I will try reporting an issue for that.

@uhyo
Copy link
Owner

uhyo commented Feb 10, 2023

Fixed in 2.2.1.

This release added /// <reference no-default-lib="true"/> to all library files and now typescript-eslint works fine.

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

No branches or pull requests

2 participants