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 · 1 comment
Open
3 tasks

Add module TypeScript definitions and compatibilty #1320

phooning opened this issue Dec 20, 2022 · 1 comment
Labels
Canvas Enhancement New feature or request

Comments

@phooning
Copy link

phooning commented Dec 20, 2022

Ref: 3825

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>)
@tomlyn tomlyn added Enhancement New feature or request Canvas labels Jul 10, 2024
@harryleesan
Copy link

@phooning I am interested in a PR for this.

I tried to look at the definition implementation that you shared, however, the link no longer works (https://github.com/phooning/canvas-ts/blob/main/%40elyra/index.ts). Please can you reshare the link, so that we don't overlap efforts.

Thanks.

samueldmeyer added a commit to samueldmeyer/canvas that referenced this issue Dec 20, 2024
samueldmeyer added a commit to samueldmeyer/canvas that referenced this issue Dec 20, 2024
samueldmeyer added a commit to samueldmeyer/canvas that referenced this issue Dec 20, 2024
samueldmeyer added a commit to samueldmeyer/canvas that referenced this issue Dec 20, 2024
samueldmeyer added a commit to samueldmeyer/canvas that referenced this issue Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Canvas Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants