Skip to content

Conversation

@chrishoage
Copy link
Contributor

Description

Relates to #778

This PR updates the index.d.ts file which defines the global variables and available types to use a namespace instead of an export of the types.

This better allows Deno to pick up the types for use (observe the deno.d.ts file uses a namespace for Deno in the same way

While having both types.ts and types_namespace.ts is a bit unfortunate, these files are automatically generated so they will always stay up to date.

This change unlocks the future for Action resource syncs since they can now be type checked outside of Komodo Core.

This PR was largely to demonstrate the steps shown in the linked GitHub issue. Feel free to either push to this branch directly, or wait as long as you want until time can be made to do the rust half of the ticket (my rust skills are not sharp enough to make the change

Steps to Test

  1. Build Komodo and start server
  2. Create file in a Deno enabled workspace with the following contents
/// <reference types="http://localhost:9120/index.d.ts" />

// Run actions using the pre initialized 'komodo' client.
const version: Types.GetVersionResponse = await komodo.read("GetVersion", {});
console.log("🦎 Komodo version:", version.version, "🦎\n");

// Access arguments using the 'ARGS' object.
console.log(ARGS);

Trigger deno to cache the imports (right click menu / action menu in VS Code)

Observe types work in editor

  1. Do the same for an action in the Komodo UI
  2. Ensure types correctly display

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

Successfully merging this pull request may close these issues.

1 participant