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

Typings file doesn't compile #143

Closed
PieterVerledens opened this issue Sep 3, 2018 · 9 comments
Closed

Typings file doesn't compile #143

PieterVerledens opened this issue Sep 3, 2018 · 9 comments

Comments

@PieterVerledens
Copy link

How can we reproduce this bug?
Try to reference the typings file and compile your code. The generic constructor throws an error.
An older version of the file works fine, but doesn't support all the features.

The changes I did on https://github.com/PieterVerledens/tribute allow me to use tribute and compile my project.

Is anyone using the typings file as is without any issues?

@Gunirus
Copy link

Gunirus commented Sep 10, 2018

@benmerckx do you have any examples on how you're using this exactly?

@benmerckx
Copy link
Contributor

benmerckx commented Sep 10, 2018

It works fine for me on typescript 2.9.2. Maybe I have something misconfigured but it doesn't seem that way (changing the constructor type gives me correct error messages). In any case if you can reproduce this, I think a simple PR changing the constructor to constructor(options: TributeOptions<any>) should do in this case? I see no way around this as it accepts an array of options too which can all be of different type.
Edit: I'm using ts-loader, a webpack loader for compiling. It's possible the loader swallows non-critical errors in d.ts files.

@Gunirus
Copy link

Gunirus commented Sep 11, 2018

node_modules/tributejs/tributejs.d.ts:61:15 - error TS1092: Type parameters cannot appear on a constructor declaration.

61   constructor<T extends {}>(options: TributeOptions<T>)
                 ~~~~~~~~~~~~

Changing the constructor to constructor(options: TributeOptions) seems to compile, I'll test if everything works.

Edit: creating an instance fails when I only change the constructor, I get
TypeError: tributejs_1.default is not a constructor

Any suggestions?

@benmerckx
Copy link
Contributor

benmerckx commented Sep 11, 2018

Edit: creating an instance fails when I only change the constructor, I get
TypeError: tributejs_1.default is not a constructor

Have a look at --esModuleInterop or import as import * as Tribute from 'tributejs'

Edit: wait it's a type error - I have no clue what's going on then

@Gunirus
Copy link

Gunirus commented Sep 13, 2018

Edit: creating an instance fails when I only change the constructor, I get
TypeError: tributejs_1.default is not a constructor

Have a look at --esModuleInterop or import as import * as Tribute from 'tributejs'

Edit: wait it's a type error - I have no clue what's going on then

Are you using the package 'as-is' in one of your projects?

@agarbund
Copy link
Contributor

I added another PR with a really easy change fixing that issue #149
Note that current .d.ts file doesn't work with the latest Angular (v6).

@mrsweaters
Copy link
Collaborator

Thank you guys for reporting this. Can you try the latest release, 3.3.5 and see if that solves your problem. I've merged in @agarbund's PR.

@agarbund
Copy link
Contributor

Yep, works for me.

@mrsweaters
Copy link
Collaborator

Sweet! I'm closing it down. Let me know if you guys have any other TypeScript issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants