Closed tbo47 closed 2 years ago
or maybe just switching to typescript instead of javascript?
Thanks for suggest.
It would be nice to have the types in the published package in npmjs.
Agree. I have to add types
to npm package.
Public diagram interface is here:
https://github.com/AlexeyBoiko/DgrmJS/blob/main/src/diagram/diagram-public-types.ts
Types in diagram-public-types.ts
must be the only types developer need to use DgrmJS.
The problem:
diagram-public-types.ts
depends on some types from presenter layer. It is needed to remove this dependence.
Then I'll add diagram-public-types.ts
to npm package.
For developers using typescript instead of javascript
Not only TypeScript developers use types
. JavaScript developers olso use types
. Types
is used for creating DgrmJs.
TypeScript notations can be used along with JSDoc.
https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
switching to typescript instead of javascript?
JavaScript with JSDoc and TypeScript notations give the developer the same tooling:
I don't see why to use TypeScript. Pros of not using the TypeScript compiler:
that makes sense
Now all public types in diagram-public-types.ts
.
You can build DgrmJS library to single js-file:
npm run build-dgrm-npm
Singls js file will be in folder
\dist\diagram-npm-package
Include this file to your typescript app. And use types from diagram-public-types.ts
.
It would be nice to have the
types
in the published package in npmjs. For developers using typescript instead of javascript.In this pull-request I only migrate
src/diagram/diagram.js
to a syntax thattypescript
understands.Let me know if you like this approach.