Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Repo: v8 branch test failures on getTypeFlags and getTypeName: Cannot read properties of undefined (reading 'id') #9426

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Suggestion

From e.g. https://cloud.nx.app/runs/95hV1MAyEv:

...
 FAIL  tests/typeFlagUtils.test.ts
  ● typeFlagUtils › getTypeFlags › when code is "type Test = any;", type flags is 1

    TypeError: Cannot read properties of undefined (reading 'id')

      19 |     const declaration = ast.body[0] as TSESTree.TSTypeAliasDeclaration;
      20 |
    > 21 |     return services.getTypeAtLocation(declaration.id);
         |                                                   ^
      22 |   }
      23 |
      24 |   describe('getTypeFlags', () => {

      at id (tests/typeFlagUtils.test.ts:21:51)
      at getType (tests/typeFlagUtils.test.ts:29:20)

 FAIL  tests/getTypeName.test.ts
  ● getTypeName › returns primitive type › when code is type Test = string;, returns string

    TypeError: Cannot read properties of undefined (reading 'id')

      20 |     const declaration = ast.body[0] as TSESTree.TSTypeAliasDeclaration;
      21 |
    > 22 |     return { checker, type: services.getTypeAtLocation(declaration.id) };
         |                                                                    ^
      23 |   }
      24 |
      25 |   function runTest(code: string, expected: string): void {

      at id (tests/getTypeName.test.ts:22:68)
      at getTypes (tests/getTypeName.test.ts:26:31)

Test Suites: 2 failed, 4 passed, 6 total

I'm confused by this. I merged the latest main from this repo into v8, but it's not happening for me locally. What are these test failures...?

🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.repo maintenancethings to do with maintenance of the repo, and not with code/docsteam assignedA member of the typescript-eslint team should work on this.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions