or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

addon-integration.mdblueprints.mdcli-commands.mdindex.mdtype-checking.md
tile.json

cli-commands.mddocs/

CLI Commands

ember-cli-typescript provides specialized CLI commands for managing TypeScript declaration files during addon publishing workflows.

Capabilities

ts:precompile Command

Generates TypeScript declaration files from TypeScript sources in preparation for publishing. This command is essential for addon authors who want to publish type definitions along with their compiled JavaScript.

interface PrecompileCommand {
  name: "ts:precompile";
  works: "insideProject";
  description: "Generates declaration files from TypeScript sources in preparation for publishing.";
  availableOptions: Array<{ name: "manifest-path"; type: StringConstructor; default: "dist/.ts-precompile-manifest" }>;
  run(options: { manifestPath: string }): Promise<void>;
}

Usage:

# Generate declaration files with default manifest path
ember ts:precompile

# Generate declaration files with custom manifest path
ember ts:precompile --manifest-path=custom/path/manifest.json

Process:

  1. Loads TypeScript configuration from tsconfig.json
  2. Runs TypeScript compiler with declaration-only output
  3. Copies generated declaration files to appropriate locations based on path mappings
  4. Creates a manifest file listing all generated files for cleanup

Requirements:

  • Must be run inside an Ember project
  • Requires valid tsconfig.json with path mappings
  • TypeScript must be installed in the project

ts:clean Command

Cleans up compiled JavaScript and declaration files that were generated by the ts:precompile command. Uses the manifest file to know exactly which files to remove.

interface CleanCommand {
  name: "ts:clean";
  works: "insideProject";
  description: "Cleans up compiled JS and declaration files generated by `ember ts:precompile`.";
  availableOptions: Array<{ name: "manifest-path"; type: StringConstructor; default: "dist/.ts-precompile-manifest" }>;
  run(options: { manifestPath: string }): void;
}

Usage:

# Clean files using default manifest path
ember ts:clean

# Clean files using custom manifest path
ember ts:clean --manifest-path=custom/path/manifest.json

Process:

  1. Reads the manifest file created by ts:precompile
  2. Removes all files and directories listed in the manifest
  3. Removes the manifest file itself
  4. Shows warning if manifest file doesn't exist

Command Configuration Helpers

Command Configuration Function

Helper function for creating type-safe Ember CLI command configurations.

/**
 * Configuration helper for defining Ember CLI commands with proper typing
 * @param options - Command configuration object
 * @returns Same configuration object with proper typing
 */
function command<T extends ExtendOptions<Command>>(
  options: T & ExtendThisType<Command, T>
): T;

Usage Example:

import { command } from "ember-cli-typescript/ts/lib/utilities/ember-cli-entities";

export default command({
  name: "my-command",
  works: "insideProject",
  description: "My custom command",
  run() {
    // Command implementation
  }
});

Constants

// Default path for the precompile manifest file
const PRECOMPILE_MANIFEST: "dist/.ts-precompile-manifest";

Integration with Publishing

These commands are typically integrated into addon publishing workflows:

package.json scripts:

{
  "scripts": {
    "prepack": "ember ts:precompile",
    "postpack": "ember ts:clean"
  }
}

This ensures declaration files are generated before publishing and cleaned up afterward, keeping the development directory clean while providing types to consumers.