node-apn icon indicating copy to clipboard operation
node-apn copied to clipboard

Modernize code (use typescript, use class syntax instead of prototype)

Open TysonAndre opened this issue 4 years ago • 6 comments

A switch to typescript may make sense in a major version

index.d.ts may get out of sync with the implementation. It may be easier to write everything in typescript and add a publish hook to convert code to typescript (https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-dynamodb/package.json https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-dynamodb/tsconfig.json)

(the publish hook would trigger a typescript build to dist/ or a subdirectory)

Alternately, with --checkJs, jsdoc can be type checked in CI


Also, class syntax can be used in node 6+ - the upstream code was supporting node 4+ and declared function Client instead of class Client https://github.com/parse-community/node-apn/blob/master/lib/client.js


What are the maintainer's thoughts on those ideas? Would you accept PRs?

TysonAndre avatar Apr 08 '21 17:04 TysonAndre

Yes. I think that it makes sense and I'd be glad to review a PR.

davimacedo avatar Apr 12 '21 05:04 davimacedo

Thanks for opening this issue!

  • ❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.

Added a bounty so hopefully someone will pick this up.

mtrezza avatar Jul 16 '23 12:07 mtrezza