loom technology plugin for typescript
npm install @shopify/loom-plugin-typescript@shopify/loom-plugin-typescriptThis package provides a loom plugin that runs TypeScript type-checking as part of the loom type-check command.
This package does not make any assumptions about what TypeScript config you should used. You will need to configure TypeScript yourself. We recommend extending from the configs provided by @shopify/typescript-configs.
``sh`
yarn add @shopify/loom-plugin-typescript --dev
Add typescript to your loom workspace plugins.
`js
import {createWorkspace} from '@shopify/loom';
import {typescript} from '@shopify/loom-plugin-typescript';
// createWorkspace may be createPackage, or createWebApp if your workspace`
// consists of a single project
export default createWorkspace((workspace) => {
workspace.use(typescript());
});
This plugin adds the following hooks to BuildWorkspaceConfigurationCustomHooks and TypeCheckWorkspaceConfigurationCustomHooks:
- typescriptHeap: a number correponding to the max size in megabytes to use for node's old memory section.
`js
import {createWorkspacePlugin} from '@shopify/loom';
function demoPlugin() {
return createWorkspacePlugin('Demo', ({tasks: {build, typeCheck}}) => {
build.hook(({hooks}) => {
hooks.configure.hook((configure) => {
// Set the heap size to 2 gigabytes
configure.typescriptHeap?.hook(() => 2048);
});
});
typeCheck.hook(({hooks}) => {
hooks.configure.hook((configure) => {
// Set the heap size to 2 gigabytes
configure.typescriptHeap?.hook(() => 2048);
});
});
});
}
``