Skip to content

[NewErrors] 4.7.1-rc vs 4.6.4 #49142

Closed
Closed

Description

The following errors were reported by 4.7.1-rc, but not by 4.6.4

coder/code-server

6 of 57 projects failed to build with the old tsc

src/tsconfig.json

facebook/docusaurus

31 of 41 projects failed to build with the old tsc

packages/docusaurus-theme-classic/tsconfig.json

reduxjs/react-redux

test/typetests/tsconfig.json

tsconfig.json

react-bootstrap/react-bootstrap

test/tsconfig.json

  • error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead?

tsconfig.json

  • error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead?

statelyai/xstate

6 of 20 projects failed to build with the old tsc

packages/xstate-inspect/tsconfig.json

packages/xstate-test/tsconfig.json

palantir/blueprint

3 of 25 projects failed to build with the old tsc

packages/docs-theme/src/tsconfig.json

lensapp/lens

6 of 9 projects failed to build with the old tsc

tsconfig.extension-api.json

tsconfig.json

webpack/tsconfig.json

Activity

  1. Josh-Cena commented on May 17, 2022

    @Josh-Cena
    Contributor
  2. DanielRosenwasser commented on May 17, 2022

    @DanielRosenwasser
    Member

    I would probably switch to as {}. Unlike unioning a never with other types (where you are enriching the absence of execution with possible executions), spreading a never sort of implies that you should get never out of it.

  3. Josh-Cena commented on May 18, 2022

    @Josh-Cena
    Contributor

    Sigh What if I told you that {} is banned by TypeScript-ESLint as well😄 But thanks for that tip, it makes sense. I'll negotiate with my linter.

  4. DanielRosenwasser commented on May 18, 2022

    @DanielRosenwasser
    Member

    Wh-really? Why? Because it insists on using object?

  5. Josh-Cena commented on May 18, 2022

    @Josh-Cena
    Contributor

    Yeah, the reason is because {} doesn't do excess property checks and even accepts primitives, so people using it to represent "empty object" would often shoot themselves in the foot. See @typescript-eslint/ban-types

  6. Josh-Cena commented on May 18, 2022

    @Josh-Cena
    Contributor

    Also, {} doesn't work, because in fact, the compiler only accepts props that's assignable to props of both div and pre, which seems to reduce to never. We'll use as any for now, but I hope there's a better pattern to do this, possibly with oneof generics.

  7. RyanCavanaugh commented on May 19, 2022

    @RyanCavanaugh
    Member
  8. RyanCavanaugh commented on May 20, 2022

    @RyanCavanaugh
    Member

    I would use as object instead of as any

  9. Josh-Cena commented on May 20, 2022

    @Josh-Cena
    Contributor

    Ref typescript-eslint/typescript-eslint#5018 (comment)

    But as object doesn't fix that particular error😢 I have yet to know a fix

    The interesting thing is even not passing any props won't work. I think it's already intersecting to never in the generic body.

  10. UNIDY2002 commented on May 25, 2022

    @UNIDY2002

    Hi, I also encountered a similar error after upgrading my TypeScript. I am using AbortController from abort-controller, and here is my code:

    import AbortController from "abort-controller";
    const controller = new AbortController();
    const init: RequestInit = {
        headers: headers,
        signal: controller.signal,
    };

    TypeScript raises an error saying:

    error TS2322: Type 'import("/.../node_modules/abort-controller/dist/abort-controller").AbortSignal' is not assignable to type 'AbortSignal'.
    
    200         signal: controller.signal,
                ~~~~~~
    

    I am wondering is there a proper way to solve this error. Thanks!

  11. DanielRosenwasser commented on May 25, 2022

    @DanielRosenwasser
    Member

    You may want to file a bug on abort-controller or add the following to your package.json and npm install.

    {
     "devDependencies": {
        "@typescript/lib-dom": "npm:@types/web"
      }
    }
  12. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions