Skip to content

ts-jest@26.4.2 cannot find namespace of interfaces #2072

@anthony-telljohann

Description

@anthony-telljohann

💥 Regression Report

Before ts-jest@26.4.2, I was able to use namespaces for interfaces. Now with ts-jest@26.4.1, my unit tests throw:

error TS2503: Cannot find namespace 'Foo'.

Last working version

Worked up to version: 26.4.1

Stopped working in version: 26.4.2

To Reproduce

Steps to reproduce the behavior:

Create a namespace for interfaces

namespace Foo {
  export interface Attribute {
    name: string
    value: string
  }
}

Use namespace in source code

export class FooAttributeFactory {
  public static create(entity: any): Foo.Attribute {
    ...
  }
}

Unit test source code

it(`should create Attribute with a name`, () => {
  expect(FooAttributeFactory.create().name).toBeDefined()
})

Expected behavior

Errors should not be thrown.

Link to repo (highly encouraged)

Debug log:

# content of ts-jest.log :
Content is too long (maximum is 65536 characters) for creating Issue.

envinfo

System:
    OS: macOS Catalina 10.15.7

Npm packages:
    jest: 26.6.1
    ts-jest: 26.4.2
    typescript: 4.0.3
    babel(optional): N/A

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions