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

Add module TypeScript definitions and compatibilty #1320

Open
3 tasks
phooning opened this issue Dec 20, 2022 · 0 comments
Open
3 tasks

Add module TypeScript definitions and compatibilty #1320

phooning opened this issue Dec 20, 2022 · 0 comments

Comments

@phooning
Copy link

Overview

Projects using @elyra/canvas are not able to read and import modules if using TypeScript - at best, modules and functions will be unknown. I propose adding TypeScript definitions to modernize the canvas and make it friendlier for JSDoc support, future project adoption, and maintainability.

I've taken the liberty to create an definition implementation here: https://github.com/phooning/canvas-ts/blob/main/%40elyra/index.ts
Where we've attempted to define function output, arguments, interfaces, and types throughout the canvas as well as appending the appropriate documentation as a JS/TSDoc comment, markdown formatted, above the function for the user to see.

As an experimental end result by using vitejs and rebuilding the canvas, I was able to alias type definitions under another namespace to import and read into TypeScript React projects and frameworks.

Example JSDoc compatibility after building with TypeScript comments:
Screenshot 2022-12-20 at 7 36 15 AM

  1. Elyra canvas should have TypeScript support either through an alternative build-phase addition (rollup TypeScript) or
  2. External d.ts files such as above linked into rollup and/or
  3. A submission with an external package with https://github.com/DefinitelyTyped/DefinitelyTyped

I would be happy to help work and PR this with whoever might be interested!

Todos:

  • common-properties
  • Removing and cleaning up unknown/unsupported types
  • Fully defining an interface and extending user custom types (like a Node<T>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant