⚠️ MAINTENANCE MODE: This addon is now in maintenance mode. TypeScript support has been integrated directly into Ember CLI as of newer versions, and this addon is no longer needed for new projects. It remains available for legacy projects and specific use cases.
ember-cli-typescript is an Ember CLI addon that provides comprehensive TypeScript support for Ember.js applications and addons. It integrates TypeScript compilation into the Ember build pipeline, provides blueprints for project setup, includes CLI commands for declaration management, and offers development-time type checking with error display.
ember install ember-cli-typescriptThis addon is primarily consumed as an Ember CLI addon and does not require direct imports in typical usage. The addon automatically integrates with Ember's build system once installed.
For advanced use cases (developing custom addons or build tools), internal utilities can be imported:
// Advanced: Internal utility functions for addon development
import { addon, command } from "ember-cli-typescript/ts/lib/utilities/ember-cli-entities";
import { copyDeclarations } from "ember-cli-typescript/ts/lib/utilities/copy-declarations";Install the addon using Ember CLI, which automatically runs the blueprint and sets up TypeScript configuration:
ember install ember-cli-typescriptThis command:
tsconfig.json and type declaration filesThe addon provides:
# Generate TypeScript declaration files for publishing
ember ts:precompile
# Clean up generated declaration files
ember ts:cleanember-cli-typescript is built around several key components:
Provides ember CLI commands for TypeScript declaration file management during addon publishing workflows.
interface Command {
name: string;
works: string;
description: string;
availableOptions: Array<{ name: string; type: any; default?: any }>;
run(options: any): Promise<void> | void;
}Core Ember CLI addon hooks and methods for integrating TypeScript support into the build pipeline.
interface AddonHooks {
included(): void;
includedCommands(): Record<string, any> | undefined;
blueprintsPath(): string;
serverMiddleware(config: { app: Application; options?: any }): void;
testemMiddleware(app: Application, options?: any): void;
postBuild(): Promise<void>;
setupPreprocessorRegistry(type: string, registry: PreprocessRegistry): void;
shouldIncludeChildAddon(addon: Addon): boolean;
}Background TypeScript compilation and error reporting system for development-time feedback.
interface TypecheckStatus {
errors: string[];
failed: boolean;
}
class TypecheckWorker {
start(projectRoot: string): void;
getStatus(): Promise<TypecheckStatus>;
onTypecheck(listener: (status: TypecheckStatus) => void): void;
}Automated project setup and configuration for TypeScript in Ember projects.
interface BlueprintLocals {
includes: string;
pathsFor: (dasherizedName: string) => string;
indexDeclarations: (dasherizedName: string) => string;
globalDeclarations: (dasherizedName: string) => string;
}// Core addon constant
const ADDON_NAME: "ember-cli-typescript";
// Precompile manifest path
const PRECOMPILE_MANIFEST: "dist/.ts-precompile-manifest";
// Live reload path excluded from typecheck middleware
const LIVE_RELOAD_PATH: "/ember-cli-live-reload.js";
// Configuration helper functions
function addon<T extends ExtendOptions<Addon>>(options: T & ExtendThisType<Addon, T>): T;
function command<T extends ExtendOptions<Command>>(options: T & ExtendThisType<Command, T>): T;
// Utility function for copying declaration files during addon publishing
function copyDeclarations(
pathRoots: string[],
paths: Record<string, string[]>,
packageName: string,
destDir: string
): string[];
// Utility function for forking child processes (used for typecheck worker)
function fork(modulePath: string): ChildProcess;