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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error message when referencing non-existent type #41935

Open
davidpcaldwell opened this issue Dec 11, 2020 · 0 comments
Open

Incorrect error message when referencing non-existent type #41935

davidpcaldwell opened this issue Dec 11, 2020 · 0 comments
Labels
Bug A bug in TypeScript
Milestone

Comments

@davidpcaldwell
Copy link

davidpcaldwell commented Dec 11, 2020

TypeScript Version: 4.0.5

Search Terms: "no exported member"

Code

foo.d.ts

namespace foo.bar {
	export interface I {
		x: string
	}
}

foo.js

//@ts-check

/** @type { foo.bar.I } */
var i;

/** @type { foo.bar.X } */
var x;

/** @type { foo.bar.I.y } */
var y;

/** @param { foo.bar.I.x } p */
function f(p) {}

jsconfig.json

{
	"exclude": [
	]
}

Expected behavior:
Should give errors like:
foo.bar doesn't have an exported type X
foo.bar.I is not a namespace
foo.bar.I is not a namespace

Actual behavior:

foo.js:6:21 - error TS2694: Namespace 'foo.bar' has no exported member 'X'.

6 /** @type { foo.bar.X } */
                      ~

foo.js:9:21 - error TS2694: Namespace 'foo.bar' has no exported member 'I'.

9 /** @type { foo.bar.I.y } */
                      ~

foo.js:12:22 - error TS2694: Namespace 'foo.bar' has no exported member 'I'.

12 /** @param { foo.bar.I.x } p */                  ~

Playground Link: Wasn't able to figure out how to create a new playground; I did examine the one for issue #27630 which resembles this one (link)

Related Issues: Possibly issue #27630 as mentioned above

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Dec 11, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants