@brayjamin/graal-type-introspection

0.1.8 • Public • Published

Graal Type Introspection

This is an experimental package that scans the user's installed graal-types, generates a JavaType.d.ts file, and allows @yam-js/core to pull in those types automatically into Java.type.

Note

The developer will need to add @yam-js into typeRoots within their tsconfig.json file

Grakkit

This is possible to be added into an existing Grakkit package, however, there are a few caveats.

  • You need to use patch-package to remove declare const Java: any; from @grakkit/stdlib/scope.d.ts.
  • Once removed, you can declare your own typedef in a d.ts file. For example:
import { JavaTypes } from '@yam-js/graal-type-introspection'

type JavaTypeKey<T extends string> = T | keyof JavaTypes

export type Java = {
  type: <Key extends string>(name: JavaTypeKey<Key>) => JavaTypes[Key]
  extend: any
}

declare global {
  const Java: Java
}

/@brayjamin/graal-type-introspection/

    Package Sidebar

    Install

    npm i @brayjamin/graal-type-introspection

    Weekly Downloads

    1

    Version

    0.1.8

    License

    MIT

    Unpacked Size

    5.77 kB

    Total Files

    5

    Last publish

    Collaborators

    • brayjamin