1.1.1 • Published 2 years ago

@shopify/loom-plugin-typescript v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@shopify/loom-plugin-typescript

This 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.

Installation

yarn add @shopify/loom-plugin-typescript --dev

Usage

Add typescript to your loom workspace plugins.

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());
});

Hooks

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.

    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);
          });
        });
      });
    }