-
Notifications
You must be signed in to change notification settings - Fork 226
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
fix module export for class #135
Conversation
Ping @delta62. It looks like you might be the resident TypeScript expert for this project |
The failure above seems unrelated, and has something to do with Sauce Labs. |
Ignore the failure. Encrypted environment variables are not available to pull requests from forks due to the security risk of exposing such information to unknown code. |
cc: @Stubb0rn |
Okay, so it seems there are a few test cases to follow through on here:
We could also test 2.7 without the |
It doesn't look like named imports ( I can spend some time this week fixing it up, or you can take another stab at it @aoberoi! |
@aoberoi I've created a PR into your feature branch that should clear up the issues. |
Add named export for TypeScript
thanks @delta62! just merged, so this PR should inherit the change :) |
this break my build ;-)
The solution is to replace : With |
Ops, sorry about that. Happy to cut a new release if you know how to fix that :) |
@dcharbonnier Could you include your |
I have a similar problem as @dcharbonnier |
Hi @yahyavi. Could you please post your |
Sure, here you go: {
"compilerOptions": {
"allowJs": true,
"module": "commonjs",
"lib": [
"dom",
"es6",
],
"target": "es6",
"sourceMap": true
},
"include": [
"./src/**/*"
]
} |
Thanks a lot! In this particular case, the code is working as I would expect. // This works
// import * as EventEmitter from 'eventemitter3'
// This works
// import { EventEmitter } from 'eventemitter3'
// This works
// import EventEmitter = require('eventemitter3')
// This works with esModuleInterop = true
// import EventEmitter from 'eventemitter3'
const emitter = new EventEmitter()
emitter.on('some-event', () => console.log('success!'))
emitter.emit('some-event') But maybe I'm missing something, or you had a different use-case in mind? edit: added import = example |
In my case |
Ah, that would make sense. If I recall correctly, WebPack makes use of Babel to bundle the files under the hood, so there could be a configuration difference between WebPack and TypeScript. |
Yeah, my guess this release broke something with webpack, because before that |
Hmm, I still can't repro this. I created a webpack / It sounds like you've got a workaround for this, so let's open a new issue if we need to continue debugging! |
I have a deadline right now. Will try to have a look at the sample project in a couple of weeks. |
This change breaks import { EventEmitter } from 'eventemitter3';
export class MyEmitter extends EventEmitter {
public constructor() {
super();
}
} results in the following error: |
Hi @shaharmor! I put the sample code you have above into my test project and it's compiling ok. I am using If you're still able to repro, let's open a new ticket to track this 🙂 |
As described in #104, I was having issues with the type definitions. I made these changes locally and it worked. My only concern is I don't have a great idea about backwards compatibility with older versions of the typescript compiler (I'm using 2.7.1 -- the latest stable).
see: https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-class-d-ts.html