serverless-mysql icon indicating copy to clipboard operation
serverless-mysql copied to clipboard

Typescript Compile Errors 'args' implicitly has 'any[]' type

Open bpred754 opened this issue 3 years ago • 1 comments

When I run tsc on project I receive the following errors:

node_modules/serverless-mysql/index.d.ts:93:11 - error TS7019: Rest parameter 'args' implicitly has an 'any[]' type.

93     query(...args): this
             ~~~~~~~

node_modules/serverless-mysql/index.d.ts:101:14 - error TS7019: Rest parameter 'args' implicitly has an 'any[]' type.

101     query<T>(...args): Promise<T>

This is requiring us to use skipLibCheck compiler option which is not ideal.

bpred754 avatar May 17 '21 15:05 bpred754

This comes from violating best practices.

If your types are generated by your source code, publish the types with your source code. Both TypeScript and JavaScript projects can generate types via --declaration.

Otherwise, we recommend submitting the types to DefinitelyTyped, which will publish them to the @types organization on npm.

Since the author of this package is not a TypeScript coder, they should also not be burdened with the task of writing and maintaining types manually (which is quite hard). Also there are no tests here for the types, so bugs will be tedious to find and regressions impossible to prevent.

I suggest to move these types to DT where they belong. I created a PR already. I would say we need some more tests over there, will continue on Monday probably. The types here should be removed from the repo asap (DT tslint check does not like them very much :D). Until then I will monkey patch this file out with patch-package.

Also this is related to #109.

levino avatar Jun 25 '21 14:06 levino

Hey, the fix for this is included in v1.5.5 🙏

naorpeled avatar Apr 08 '23 13:04 naorpeled