Installation
npm install --save @types/ember__controller
Summary
This package contains type definitions for @ember/controller (https://emberjs.com/api/ember/4.0/modules/@ember%2Fcontroller).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ember__controller.
import EmberObject from "@ember/object";
import ActionHandler from "@ember/object/-private/action-handler";
import ComputedProperty from "@ember/object/computed";
import Mixin from "@ember/object/mixin";
type QueryParamTypes = "boolean" | "number" | "array" | "string";
type QueryParamScopeTypes = "controller" | "model";
interface QueryParamConfig {
type?: QueryParamTypes | undefined;
scope?: QueryParamScopeTypes | undefined;
as?: string | undefined;
}
interface ControllerMixin extends ActionHandler {
replaceRoute(name: string, ...args: any[]): void;
transitionToRoute(name: string, ...args: any[]): void;
transitionToRoute(...args: any[]): void;
model: unknown;
queryParams: Readonly<Array<string | Record<string, QueryParamConfig | string | undefined>>>;
target: object;
}
export default class Controller extends EmberObject {}
export default interface Controller extends ControllerMixin {}
export function inject(): ComputedProperty<Controller>;
export function inject<K extends keyof Registry>(name: K): ComputedProperty<Registry[K]>;
export function inject(target: object, propertyKey: string | symbol): void;
export interface Registry extends Record<string, Controller | undefined> {}
declare module "@ember/owner" {
interface DIRegistry {
controller: Registry;
}
}
export {};
Additional Details
Credits
These definitions were written by Krystan HuffMenne, James C. Davis, and Peter Wagenet.