Title: [bug?] Cannot find name 'EventEmitter', property 'channel' of exported interface has or is using private name 'EventEmitter'. · Issue #28754 · microsoft/TypeScript · GitHub
Open Graph Title: [bug?] Cannot find name 'EventEmitter', property 'channel' of exported interface has or is using private name 'EventEmitter'. · Issue #28754 · microsoft/TypeScript
X Title: [bug?] Cannot find name 'EventEmitter', property 'channel' of exported interface has or is using private name 'EventEmitter'. · Issue #28754 · microsoft/TypeScript
Description: TypeScript Version: 3.3.0-dev.20181129 Search Terms: The search results led to issues like this one: #6307 Code // ./Events.ts class EventTypes { constructor( public SOME_EVENT: any, public OTHER_EVENT: any, ) {} } export const Events = ...
Open Graph Description: TypeScript Version: 3.3.0-dev.20181129 Search Terms: The search results led to issues like this one: #6307 Code // ./Events.ts class EventTypes { constructor( public SOME_EVENT: any, public OTHER_E...
X Description: TypeScript Version: 3.3.0-dev.20181129 Search Terms: The search results led to issues like this one: #6307 Code // ./Events.ts class EventTypes { constructor( public SOME_EVENT: any, public OTHER_E...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/28754
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[bug?] Cannot find name 'EventEmitter', property 'channel' of exported interface has or is using private name 'EventEmitter'.","articleBody":"**TypeScript Version:** 3.3.0-dev.20181129\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\n\r\nThe search results led to issues like this one: https://github.com/Microsoft/TypeScript/issues/6307\r\n\r\n**Code**\r\n\r\n```ts\r\n// ./Events.ts\r\nclass EventTypes {\r\n constructor(\r\n public SOME_EVENT: any,\r\n public OTHER_EVENT: any,\r\n ) {}\r\n}\r\n\r\nexport const Events = {} as { [k in keyof EventTypes]: k }\r\n\r\nfor (const key in new (EventTypes as any)) {\r\n Events[key] = key\r\n}\r\n\r\nimport * as events from 'events' // definitions are from `@types/node`\r\n\r\n// our own (better, more type-safe) definition of EventEmitter\r\ninterface BetterEventEmitter\u003cEventTypes> {\r\n new(): BetterEventEmitter\u003cEventTypes>\r\n addListener\u003cEventName extends keyof EventTypes> (event: EventName, listener: (arg: EventTypes[EventName]) => void);\r\n on\u003cEventName extends keyof EventTypes> (event: EventName, listener: (arg: EventTypes[EventName]) => void);\r\n once\u003cEventName extends keyof EventTypes> (event: EventName, listener: (arg: EventTypes[EventName]) => void);\r\n removeListener\u003cEventName extends keyof EventTypes> (event: EventName, listener: (arg: EventTypes[EventName]) => void);\r\n removeAllListeners\u003cEventName extends keyof EventTypes>(event?: EventName): this;\r\n emit\u003cEventName extends keyof EventTypes>(event: EventName, arg: EventTypes[EventName]): boolean;\r\n eventNames\u003cEventName extends keyof EventTypes>(): Array\u003cEventName>;\r\n setMaxListeners(n: number): this;\r\n getMaxListeners(): number;\r\n listeners\u003cEventName extends keyof EventTypes>(event: EventName): (arg: EventTypes[EventName]) => void[];\r\n listenerCount\u003cEventName extends keyof EventTypes>(type: EventName): number;\r\n prependListener\u003cEventName extends keyof EventTypes>(event: EventName, listener: (arg: EventTypes[EventName]) => void): this;\r\n prependOnceListener\u003cEventName extends keyof EventTypes>(event: EventName, listener: (arg: EventTypes[EventName]) => void): this;\r\n}\r\n\r\n// override Node EventEmitter with our definition\r\nexport const EventEmitter = events.EventEmitter as unknown as BetterEventEmitter\u003cEventTypes>\r\n```\r\n\r\n```js\r\n// consumer.ts\r\nimport { Events, EventEmitter } from './models/Events' // ERROR: `EventEmitter` is declared but its value is never read.\r\n\r\nconst channel = new EventEmitter // works fine, no error!\r\n\r\nclass Foo {\r\n channel: EventEmitter // ERROR, Cannot find name 'EventEmitter'\r\n}\r\n\r\nexport interface Bar {\r\n channel: EventEmitter // ERROR, Cannot find name 'EventEmitter', property 'channel' of exported interface has or is using private name 'EventEmitter'.\r\n}\r\n```\r\n\r\n\r\n**Expected behavior:**\r\n\r\nI expect not to get the `ERROR`s I've marked in the above comments.\r\n\r\n\r\n**Actual behavior:**\r\n\r\nI'm getting those errors.\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\n\r\nI can't put multiple files in Playground or install dependencies.\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\n\r\n\r\nhttps://github.com/Microsoft/TypeScript/issues/6307","author":{"url":"https://github.com/trusktr","@type":"Person","name":"trusktr"},"datePublished":"2018-11-30T02:39:07Z","url":"https://github.com/microsoft/TypeScript/issues/28754"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:95a67e5f-3d54-9d4e-e32e-f4a63fbcb3f2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A1DC:31EA53:11DD7B6:18FB5C5:6AFA1868 |
| html-safe-nonce | 1850dcc20d1b48ff43baee667af1eb9b93616abcd40cf35e6141ebc8c8d97440 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMURDOjMxRUE1MzoxMUREN0I2OjE4RkI1QzU6NkFGQTE4NjgiLCJ2aXNpdG9yX2lkIjoiODk4NjYwNzkzMzQ4MzI2MDAwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 605f70920eceb1e729896b8313e575340e480da55a9e884fcc2074acc9339ec4 |
| hovercard-subject-tag | issue:386012963 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/28754/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ac69781c3d570ddc61d76e8e6cb515b971aeb037f5b8fc6877d8b2259bf2f060/microsoft/TypeScript/issues/28754 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ac69781c3d570ddc61d76e8e6cb515b971aeb037f5b8fc6877d8b2259bf2f060/microsoft/TypeScript/issues/28754 |
| og:image:alt | TypeScript Version: 3.3.0-dev.20181129 Search Terms: The search results led to issues like this one: #6307 Code // ./Events.ts class EventTypes { constructor( public SOME_EVENT: any, public OTHER_E... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trusktr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width