-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[bug?] Cannot find name 'EventEmitter', property 'channel' of exported interface has or is using private name 'EventEmitter'. #28754
Comments
(My |
You export const EventEmitter but you also need to export a type named |
Ah I see, yep it works. It's not so intuitive though. Isn't it obvious that I'm exporting a constructor (therefore a type)? Seems like the compiler should be able to pick that up. |
I'll close this though, as that's indeed how to make it work, but curious what you think about the compiler being able to detect that I'm exporting a constructor (and therefore a type). |
This declaration stuff is funky. I'm on typescript Now that I fixed that problem by adding the export of the type, not just the runtime value, I now have an error in another file:
on some code that looks like import { Events, EventEmitter } from '../models/Events'
export abstract class Foo {
protected constructor(
readonly channel?: EventEmitter, // ERROR here
) {
// ...
}
// ...
} Here's a screenshot: Looks like maybe #9944 is not fixed. However, this only happens to me in one file, but I can't reproduce it in another file. So something is weird here. |
I was able to fix the previous comment's error by changing interface BetterEventEmitter<EventTypes> { to export interface BetterEventEmitter<EventTypes> { but I shouldn't have to do that, I'm not importing that name anywhere, it is only ever used in the definition of what Looks like that |
Use |
It's hard to understand why, as with my eyes I can locate it just fine. Thanks for that tip! |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
TypeScript Version: 3.3.0-dev.20181129
Search Terms:
The search results led to issues like this one: #6307
Code
Expected behavior:
I expect not to get the
ERROR
s I've marked in the above comments.Actual behavior:
I'm getting those errors.
Playground Link:
I can't put multiple files in Playground or install dependencies.
Related Issues:
#6307
The text was updated successfully, but these errors were encountered: