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

v1.6.0 broke typescript support in strict mode #80

Closed
P4sca1 opened this issue Feb 7, 2020 · 4 comments · Fixed by #82
Closed

v1.6.0 broke typescript support in strict mode #80

P4sca1 opened this issue Feb 7, 2020 · 4 comments · Fixed by #82

Comments

@P4sca1
Copy link

P4sca1 commented Feb 7, 2020

Description

Trying to build a project that uses vue-gtag fails when type check and typescript strict mode is enabled.

Expected behavior

Build should work in strict mode.

Actual behavior

$ tsc --project ./tsconfig.json --noEmit
../../node_modules/vue-gtag/vue-gtag.d.ts:173:5 - error TS7010: 'config', which lacks return-type annotation, implicitly has an 'any' return type.

173     config(config?: GtagGenericParams);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/vue-gtag/vue-gtag.d.ts:174:5 - error TS7010: 'time', which lacks return-type annotation, implicitly has an 'any' return type.

174     time(timing: Timing);
        ~~~~~~~~~~~~~~~~~~~~~

../../node_modules/vue-gtag/vue-gtag.d.ts:208:30 - error TS7006: Parameter 'PluginOptions' implicitly has an 'any' type.

208   export function setOptions(PluginOptions): void;

Environment

vue-gtag 1.6.0
MacOS Catalina
TypeScript 3.7.5

@MatteoGabriele
Copy link
Owner

@cesasol or @namoscato could you guys have a look at it? unfortunately I don't use typescript so I have no clue 🤣
@P4sca1 you can also open a PR and fix it you know what's the issue.

thanks a lot!

@lisafrancoise
Copy link

In vue-gtag.d.ts file, two functions doesn't have a return type and one parameter isn't typed which is causing the issue.

I had the same issue and have just updated this file

line 173
config(config?: GtagGenericParams): any;

line 174
time(timing: Timing): any;

line 208
export function setOptions(PluginOptions: PluginOptions): void;

That's not the best solution (especially for the "any" return type, it should be best to have the exact return type but I didn't dig deep into it) but it's a workaround for the moment.

@namoscato
Copy link
Contributor

could you guys have a look at it?

Yeah, I can take a pass within the next couple of days.

Looking at #63, some of the optional event() type properties were incorrectly reverted, so we'll have to fix that as well.

namoscato added a commit to namoscato/vue-gtag that referenced this issue Feb 8, 2020
Fixes MatteoGabriele#80

* Wrap [at]types/gtag.js in namespace for clarity
* Fix event() parameters
* Fix strict mode compatibility
* Add doc blocks
MatteoGabriele pushed a commit that referenced this issue Feb 8, 2020
@MatteoGabriele
Copy link
Owner

🎉 This issue has been resolved in version 1.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

4 participants