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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anthony-telljohann opened this issue Oct 26, 2020 · 2 comments
Closed

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

anthony-telljohann opened this issue Oct 26, 2020 · 2 comments

Comments

@anthony-telljohann
Copy link

@anthony-telljohann anthony-telljohann commented Oct 26, 2020

馃挜 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
@anthony-telljohann anthony-telljohann changed the title ts-jest@26.4.1 cannot find namespace of interfaces ts-jest@26.4.2 cannot find namespace of interfaces Oct 26, 2020
@ahnpnl
Copy link
Collaborator

@ahnpnl ahnpnl commented Oct 26, 2020

Hi, did you define your namespace in .ts file but not .d.ts ?

@ahnpnl
Copy link
Collaborator

@ahnpnl ahnpnl commented Oct 26, 2020

fixed in #2062

@ahnpnl ahnpnl closed this Oct 26, 2020
@ahnpnl ahnpnl linked a pull request that will close this issue Oct 26, 2020
1 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can鈥檛 perform that action at this time.