@chouquette/gleam-ts-loader
v1.0.1
Published
TypeScript plugin bringing types when using `gleam:` protocol.
Maintainers
Readme
Gleam TypeScript Loader
Add first class support for Gleam modules directly in TypeScript. Use
@chouquette/gleam-ts-loader to bring Gleam types in your regular import when
using
@chouquette/gleam-node-loader
or
@chouquette/gleam-vite-loader.
Getting Started
yarn add @chouquette/gleam-ts-loaderConfiguring Gleam to output TypeScript declarations
By default, Gleam will not output TypeScript declarations. Modify your
gleam.toml to add declarations.
# In gleam.toml
[javascript]
typescript_declarations = trueThen, clear your existing artifacts, and rebuild the project.
gleam clean
gleam buildAdding the plugin to tsconfig.json
Once the loader is installed, you need to add it to TypeScript. Edit your
tsconfig.json, and add the plugin in the plugins field.
{
...
"plugins": [{ "name": "@chouquette/gleam-ts-loader" }],
...
}And tada! You have nothing more to do. Starting now, every time you import a
Gleam file with import * as gleam from 'gleam:prelude', you'll get complete
typechecking.
Contributing
Pull Requests are welcome! Feel free to open a Pull Request or open an issue if you encounter any problem with the loader.
