[ember] @ember/routing as source of types, ember as re-export

This commit is contained in:
Mike North 2018-09-20 13:49:58 -07:00
parent 478a3c1a79
commit afa85f2af4
21 changed files with 748 additions and 646 deletions

View File

@ -10,6 +10,7 @@
/// <reference types="ember__object" />
/// <reference types="ember__controller" />
/// <reference types="ember__routing" />
/// <reference types="ember__test" />
declare module 'ember-data' {
import Ember from 'ember';
@ -2093,38 +2094,34 @@ declare module 'ember-data' {
normalize(typeClass: Model, hash: {}): {};
}
}
/**
* The store is automatically injected into these objects
*
* https://github.com/emberjs/data/blob/05e95280e11c411177f2fbcb65fd83488d6a9d89/addon/setup-container.js#L71-L78
*/
module '@ember/controller' {
export default interface Controller {
store: DS.Store;
}
}
export default DS;
}
declare module 'ember' {
import DS from 'ember-data';
namespace Ember {
/*
* The store is automatically injected into these objects
*
* https://github.com/emberjs/data/blob/05e95280e11c411177f2fbcb65fd83488d6a9d89/addon/setup-container.js#L71-L78
*/
interface Route {
store: DS.Store;
}
interface DataAdapter {
module '@ember/routing/route' {
export default interface Route {
store: DS.Store;
}
}
module '@ember/debug/data-adapter' {
export default interface DataAdapter {
store: DS.Store;
}
}
// It is also available to inject anywhere
module '@ember/service' {
interface Registry {
'store': DS.Store;
}
}
export default DS;
}
declare module 'ember-test-helpers' {
import DS from 'ember-data';
interface TestContext {

View File

@ -18,7 +18,11 @@
"@ember/debug/*": ["ember__debug/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/controller": ["ember__controller"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},

609
types/ember/index.d.ts vendored
View File

@ -23,6 +23,7 @@
/// <reference types="ember__debug" />
/// <reference types="ember__controller" />
/// <reference types="ember__component" />
/// <reference types="ember__routing" />
declare module 'ember' {
import {
@ -57,7 +58,7 @@ declare module 'ember' {
// @ember/debug
import * as EmberDebugNs from '@ember/debug';
import _ContainerDebugAdapter from '@ember/debug/container-debug-adapter';
import _DataAdapter from '@ember/debug/data-adapter';
import EmberDataAdapter from '@ember/debug/data-adapter';
// @ember/engine
import * as EmberEngineNs from '@ember/engine';
import * as EmberEngineInstanceNs from '@ember/engine/instance';
@ -85,6 +86,16 @@ declare module 'ember' {
import EmberTextField from '@ember/component/text-field';
import EmberCheckbox from '@ember/component/checkbox';
import EmberHelper from '@ember/component/helper';
// @ember/routing
import EmberRoutingRouter from '@ember/routing/router';
import EmberRoutingRoute from '@ember/routing/route';
import EmberRoutingTransition from '@ember/routing/-private/transition';
import EmberRoutingRouterService from '@ember/routing/router-service';
import EmberRoutingHashLocation from '@ember/routing/hash-location';
import EmberRoutingAutoLocation from '@ember/routing/auto-location';
import EmberRoutingHistoryLocation from '@ember/routing/history-location';
import EmberRoutingNoneLocation from '@ember/routing/none-location';
import EmberRoutingLinkComponent from '@ember/routing/link-component';
type Mix<A, B> = B & Pick<A, Exclude<keyof A, keyof B>>;
type Mix3<A, B, C> = Mix<Mix<A, B>, C>;
@ -121,20 +132,6 @@ declare module 'ember' {
| 'afterRender'
| 'destroy';
interface RenderOptions {
into?: string;
controller?: string;
model?: any;
outlet?: string;
view?: string;
}
interface RouteQueryParam {
refreshModel?: boolean;
replace?: boolean;
as?: string;
}
interface EventDispatcherEvents {
touchstart?: string | null;
touchmove?: string | null;
@ -187,6 +184,8 @@ declare module 'ember' {
export const NativeArray: typeof EmberNativeArray;
export type MutableEnumerable<T> = EmberMutableEnumerable<T>;
export const MutableEnumerable: typeof EmberMutableEnumerable;
class Router extends EmberRoutingRouter {}
class Route extends EmberRoutingRoute {}
const ActionHandler: typeof EmberActionHandler;
class Controller extends EmberControllerNs.default {}
export class Component extends EmberComponent {}
@ -194,6 +193,11 @@ declare module 'ember' {
export class TextField extends EmberTextField {}
export class Checkbox extends EmberCheckbox {}
export class Helper extends EmberHelper {}
export class HashLocation extends EmberRoutingHashLocation {}
export class NoneLocation extends EmberRoutingNoneLocation {}
export class HistoryLocation extends EmberRoutingHistoryLocation {}
export class LinkComponent extends EmberRoutingLinkComponent {}
interface FunctionPrototypeExtensions {
/**
* The `property` extension of Javascript's Function prototype is available
@ -331,10 +335,6 @@ declare module 'ember' {
*/
class ApplicationInstance extends EngineInstance {}
/**
* AutoLocation will select the best location option based off browser support with the priority order: history, hash, none.
*/
class AutoLocation extends Object {}
/**
* Connects the properties of two objects so that whenever the value of one property changes,
* the other property will be changed also.
@ -379,7 +379,7 @@ declare module 'ember' {
const Observable: typeof EmberObservable;
const PromiseProxyMixin: typeof EmberObjectPromiseProxyNs.default;
class CoreObject extends EmberCoreObject {}
class DataAdapter extends _DataAdapter {}
class DataAdapter extends EmberDataAdapter {}
const Debug: {
registerDeprecationHandler: typeof EmberDebugNs.registerDeprecationHandler;
registerWarnHandler: typeof EmberDebugNs.registerWarnHandler;
@ -436,18 +436,6 @@ declare module 'ember' {
isFrozen: boolean;
}
const Freezable: EmberMixin<Freezable>;
/**
* `Ember.HashLocation` implements the location API using the browser's
* hash. At present, it relies on a `hashchange` event existing in the
* browser.
*/
class HashLocation extends Object {}
/**
* Ember.HistoryLocation implements the location API using the browser's
* history.pushState API.
*/
class HistoryLocation extends Object {}
/**
* The purpose of the Ember Instrumentation module is
* to provide efficient, general-purpose instrumentation
@ -459,55 +447,6 @@ declare module 'ember' {
subscribe(pattern: string, object: any): void;
unsubscribe(subscriber: any): void;
};
/**
* `Ember.LinkComponent` renders an element whose `click` event triggers a
* transition of the application's instance of `Ember.Router` to
* a supplied route by name.
*/
class LinkComponent extends EmberComponent {
/**
* Used to determine when this `LinkComponent` is active.
*/
currentWhen: any;
/**
* Sets the `title` attribute of the `LinkComponent`'s HTML element.
*/
title: string | null;
/**
* Sets the `rel` attribute of the `LinkComponent`'s HTML element.
*/
rel: string | null;
/**
* Sets the `tabindex` attribute of the `LinkComponent`'s HTML element.
*/
tabindex: string | null;
/**
* Sets the `target` attribute of the `LinkComponent`'s HTML element.
*/
target: string | null;
/**
* The CSS class to apply to `LinkComponent`'s element when its `active`
* property is `true`.
*/
activeClass: string;
/**
* Determines whether the `LinkComponent` will trigger routing via
* the `replaceWith` routing strategy.
*/
replace: boolean;
}
/**
* Ember.Location returns an instance of the correct implementation of
* the `location` API.
*/
const Location: {
/**
* This is deprecated in favor of using the container to lookup the location
* implementation as desired.
* @deprecated Use the container to lookup the location implementation that you need.
*/
create(options?: {}): any;
};
/**
* Inside Ember-Metal, simply uses the methods from `imports.console`.
* Override this to provide more robust logging functionality.
@ -568,13 +507,7 @@ declare module 'ember' {
* to define one of these new containers.
*/
class Namespace extends Object {}
/**
* Ember.NoneLocation does not interact with the browser. It is useful for
* testing, or when you need to manage state with your Router, but temporarily
* don't want it to muck with the URL (for example when you embed your
* application in a larger page).
*/
class NoneLocation extends Object {}
/**
* This class is used internally by Ember and Ember Data.
* Please do not use it at this time. We plan to clean it up
@ -604,342 +537,7 @@ declare module 'ember' {
): void;
}
class Resolver extends Ember.Object {}
/**
* The `Ember.Route` class is used to define individual routes. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
class Route extends Object.extend(ActionHandler, Evented) {
// methods
/**
* This hook is called after this route's model has resolved.
* It follows identical async/promise semantics to `beforeModel`
* but is provided the route's resolved model in addition to
* the `transition`, and is therefore suited to performing
* logic that can only take place after the model has already
* resolved.
*/
afterModel(resolvedModel: any, transition: Transition): any;
/**
* This hook is the first of the route entry validation hooks
* called when an attempt is made to transition into a route
* or one of its children. It is called before `model` and
* `afterModel`, and is appropriate for cases when:
* 1) A decision can be made to redirect elsewhere without
* needing to resolve the model first.
* 2) Any async operations need to occur first before the
* model is attempted to be resolved.
* This hook is provided the current `transition` attempt
* as a parameter, which can be used to `.abort()` the transition,
* save it for a later `.retry()`, or retrieve values set
* on it from a previous hook. You can also just call
* `this.transitionTo` to another route to implicitly
* abort the `transition`.
* You can return a promise from this hook to pause the
* transition until the promise resolves (or rejects). This could
* be useful, for instance, for retrieving async code from
* the server that is required to enter a route.
*/
beforeModel(transition: Transition): any;
/**
* Returns the controller for a particular route or name.
* The controller instance must already have been created, either through entering the
* associated route or using `generateController`.
*/
controllerFor<K extends keyof ControllerRegistry>(name: K): ControllerRegistry[K];
/**
* Disconnects a view that has been rendered into an outlet.
*/
disconnectOutlet(options: string | { outlet?: string; parentView?: string }): void;
/**
* A hook you can implement to convert the URL into the model for
* this route.
*/
model(params: {}, transition: Transition): any;
/**
* Returns the model of a parent (or any ancestor) route
* in a route hierarchy. During a transition, all routes
* must resolve a model object, and if a route
* needs access to a parent route's model in order to
* resolve a model (or just reuse the model from a parent),
* it can call `this.modelFor(theNameOfParentRoute)` to
* retrieve it.
*/
modelFor(name: string): {};
/**
* Retrieves parameters, for current route using the state.params
* variable and getQueryParamsFor, using the supplied routeName.
*/
paramsFor(name: string): {};
/**
* Refresh the model on this route and any child routes, firing the
* `beforeModel`, `model`, and `afterModel` hooks in a similar fashion
* to how routes are entered when transitioning in from other route.
* The current route params (e.g. `article_id`) will be passed in
* to the respective model hooks, and if a different model is returned,
* `setupController` and associated route hooks will re-fire as well.
* An example usage of this method is re-querying the server for the
* latest information using the same parameters as when the route
* was first entered.
* Note that this will cause `model` hooks to fire even on routes
* that were provided a model object when the route was initially
* entered.
*/
redirect(): Transition;
/**
* Refresh the model on this route and any child routes, firing the
* `beforeModel`, `model`, and `afterModel` hooks in a similar fashion
* to how routes are entered when transitioning in from other route.
* The current route params (e.g. `article_id`) will be passed in
* to the respective model hooks, and if a different model is returned,
* `setupController` and associated route hooks will re-fire as well.
* An example usage of this method is re-querying the server for the
* latest information using the same parameters as when the route
* was first entered.
* Note that this will cause `model` hooks to fire even on routes
* that were provided a model object when the route was initially
* entered.
*/
refresh(): Transition;
/**
* `render` is used to render a template into a region of another template
* (indicated by an `{{outlet}}`). `render` is used both during the entry
* phase of routing (via the `renderTemplate` hook) and later in response to
* user interaction.
*/
render(name: string, options?: RenderOptions): void;
/**
* A hook you can use to render the template for the current route.
* This method is called with the controller for the current route and the
* model supplied by the `model` hook. By default, it renders the route's
* template, configured with the controller for the route.
* This method can be overridden to set up and render additional or
* alternative templates.
*/
renderTemplate(controller: Controller, model: {}): void;
/**
* Transition into another route while replacing the current URL, if possible.
* This will replace the current history entry instead of adding a new one.
* Beside that, it is identical to `transitionTo` in all other respects. See
* 'transitionTo' for additional information regarding multiple models.
*/
replaceWith(name: string, ...args: any[]): Transition;
/**
* A hook you can use to reset controller values either when the model
* changes or the route is exiting.
*/
resetController(controller: Controller, isExiting: boolean, transition: any): void;
/**
* Sends an action to the router, which will delegate it to the currently active
* route hierarchy per the bubbling rules explained under actions.
*/
send(name: string, ...args: any[]): void;
/**
* A hook you can implement to convert the route's model into parameters
* for the URL.
*
* The default `serialize` method will insert the model's `id` into the
* route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'.
* If the route has multiple dynamic segments or does not contain '_id', `serialize`
* will return `Ember.getProperties(model, params)`
* This method is called when `transitionTo` is called with a context
* in order to populate the URL.
*/
serialize(model: {}, params: string[]): string | object;
/**
* A hook you can use to setup the controller for the current route.
* This method is called with the controller for the current route and the
* model supplied by the `model` hook.
* By default, the `setupController` hook sets the `model` property of
* the controller to the `model`.
* If you implement the `setupController` hook in your Route, it will
* prevent this default behavior. If you want to preserve that behavior
* when implementing your `setupController` function, make sure to call
* `_super`
*/
setupController(controller: Controller, model: {}): void;
/**
* Transition the application into another route. The route may
* be either a single route or route path
*/
transitionTo(name: string, ...object: any[]): Transition;
/**
* The name of the view to use by default when rendering this routes template.
* When rendering a template, the route will, by default, determine the
* template and view to use from the name of the route itself. If you need to
* define a specific view, set this property.
* This is useful when multiple routes would benefit from using the same view
* because it doesn't require a custom `renderTemplate` method.
*/
transitionTo(name: string, ...object: any[]): Transition;
// https://emberjs.com/api/ember/3.2/classes/Route/methods/intermediateTransitionTo?anchor=intermediateTransitionTo
/**
* Perform a synchronous transition into another route without attempting to resolve promises,
* update the URL, or abort any currently active asynchronous transitions
* (i.e. regular transitions caused by transitionTo or URL changes).
*
* @param name the name of the route or a URL
* @param object the model(s) or identifier(s) to be used while
* transitioning to the route.
* @returns the Transition object associated with this attempted transition
*/
intermediateTransitionTo(name: string, ...object: any[]): Transition;
// properties
/**
* The controller associated with this route.
*/
controller: Controller;
/**
* The name of the controller to associate with this route.
* By default, Ember will lookup a route's controller that matches the name
* of the route (i.e. `App.PostController` for `App.PostRoute`). However,
* if you would like to define a specific controller to use, you can do so
* using this property.
* This is useful in many ways, as the controller specified will be:
* * p assed to the `setupController` method.
* * used as the controller for the view being rendered by the route.
* * returned from a call to `controllerFor` for the route.
*/
controllerName: string;
/**
* Configuration hash for this route's queryParams.
*/
queryParams: { [key: string]: RouteQueryParam };
/**
* The name of the route, dot-delimited
*/
routeName: string;
/**
* The name of the template to use by default when rendering this routes
* template.
* This is similar with `viewName`, but is useful when you just want a custom
* template without a view.
*/
templateName: string;
// events
/**
* This hook is executed when the router enters the route. It is not executed
* when the model for the route changes.
*/
activate(): void;
/**
* This hook is executed when the router completely exits this route. It is
* not executed when the model for the route changes.
*/
deactivate(): void;
/**
* The didTransition action is fired after a transition has successfully been
* completed. This occurs after the normal model hooks (beforeModel, model,
* afterModel, setupController) have resolved. The didTransition action has
* no arguments, however, it can be useful for tracking page views or resetting
* state on the controller.
*/
didTransition(): void;
/**
* When attempting to transition into a route, any of the hooks may return a promise
* that rejects, at which point an error action will be fired on the partially-entered
* routes, allowing for per-route error handling logic, or shared error handling logic
* defined on a parent route.
*/
error(error: any, transition: Transition): void;
/**
* The loading action is fired on the route when a route's model hook returns a
* promise that is not already resolved. The current Transition object is the first
* parameter and the route that triggered the loading event is the second parameter.
*/
loading(transition: Transition, route: Route): void;
/**
* The willTransition action is fired at the beginning of any attempted transition
* with a Transition object as the sole argument. This action can be used for aborting,
* redirecting, or decorating the transition from the currently active routes.
*/
willTransition(transition: Transition): void;
}
/**
* The `Ember.Router` class manages the application state and URLs. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
class Router extends Object.extend(Evented) {
/**
* The `Router.map` function allows you to define mappings from URLs to routes
* in your application. These mappings are defined within the
* supplied callback function using `this.route`.
*/
static map(callback: (this: RouterDSL) => void): void;
/**
* The `location` property determines the type of URL's that your
* application will use.
*/
location: string;
/**
* Represents the URL of the root of the application, often '/'. This prefix is
* assumed on all routes defined on this router.
*/
rootURL: string;
/**
* Handles updating the paths and notifying any listeners of the URL
* change.
*/
didTransition(): any;
/**
* Handles notifying any listeners of an impending URL
* change.
*/
willTransition(): any;
/**
* Transition the application into another route. The route may
* be either a single route or route path:
*/
transitionTo(name: string, options?: {}): Transition;
transitionTo(name: string, ...models: any[]): Transition;
transitionTo(name: string, options: {}): Transition;
}
class RouterDSL {
constructor(name: string, options: object);
route(name: string, callback: (this: RouterDSL) => void): void;
route(
name: string,
options?: { path?: string; resetNamespace?: boolean },
callback?: (this: RouterDSL) => void
): void;
mount(
name: string,
options?: {
as?: string,
path?: string,
resetNamespace?: boolean,
engineInfo?: any
}
): void;
}
class Service extends Object {}
interface Transition {
/**
@ -1603,126 +1201,9 @@ declare module 'ember' {
const expandProperties: typeof EmberObjectComputedNs.expandProperties;
}
type RouteModel = object | string | number;
// https://emberjs.com/api/ember/2.18/classes/RouterService
/**
* The Router service is the public API that provides component/view layer access to the router.
*/
export class RouterService extends Ember.Service {
//
/**
* Name of the current route.
* This property represent the logical name of the route,
* which is comma separated.
* For the following router:
* ```app/router.js
* Router.map(function() {
* this.route('about');
* this.route('blog', function () {
* this.route('post', { path: ':post_id' });
* });
* });
* ```
* It will return:
* * `index` when you visit `/`
* * `about` when you visit `/about`
* * `blog.index` when you visit `/blog`
* * `blog.post` when you visit `/blog/some-post-id`
*/
readonly currentRouteName: string;
//
/**
* Current URL for the application.
* This property represent the URL path for this route.
* For the following router:
* ```app/router.js
* Router.map(function() {
* this.route('about');
* this.route('blog', function () {
* this.route('post', { path: ':post_id' });
* });
* });
* ```
* It will return:
* * `/` when you visit `/`
* * `/about` when you visit `/about`
* * `/blog` when you visit `/blog`
* * `/blog/some-post-id` when you visit `/blog/some-post-id`
*/
readonly currentURL: string;
//
/**
* Determines whether a route is active.
*
* @param routeName the name of the route
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route
* @param options optional hash with a queryParams property containing a
* mapping of query parameters
*/
isActive(routeName: string, options?: { queryParams: object }): boolean;
isActive(routeName: string, models: RouteModel, options?: { queryParams: object }): boolean;
isActive(routeName: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): boolean;
isActive(routeName: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): boolean;
isActive(routeName: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, modelsD: RouteModel, options?: { queryParams: object }): boolean;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=replaceWith
/**
* Transition into another route while replacing the current URL, if
* possible. The route may be either a single route or route path.
*
* @param routeNameOrUrl the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property
* containing a mapping of query parameters
* @returns the Transition object associated with this attempted transition
*/
replaceWith(routeNameOrUrl: string, options?: { queryParams: object }): Ember.Transition;
replaceWith(routeNameOrUrl: string, models: RouteModel, options?: { queryParams: object }): Ember.Transition;
replaceWith(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): Ember.Transition;
replaceWith(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): Ember.Transition;
replaceWith(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, modelsD: RouteModel, options?: { queryParams: object }): Ember.Transition;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=transitionTo
/**
* Transition the application into another route. The route may be
* either a single route or route path
*
* @param routeNameOrUrl the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property
* containing a mapping of query parameters
* @returns the Transition object associated with this attempted transition
*/
transitionTo(routeNameOrUrl: string, options?: { queryParam: object }): Ember.Transition;
transitionTo(routeNameOrUrl: string, models: RouteModel, options?: { queryParams: object }): Ember.Transition;
transitionTo(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): Ember.Transition;
transitionTo(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): Ember.Transition;
transitionTo(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, modelsD: RouteModel, options?: { queryParams: object }): Ember.Transition;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=urlFor
/**
* Generate a URL based on the supplied route name.
*
* @param routeName the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property containing
* a mapping of query parameters
* @returns the string representing the generated URL
*/
urlFor(routeName: string, options?: { queryParams: object }): string;
urlFor(routeName: string, models: RouteModel, options?: { queryParams: object }): string;
urlFor(routeName: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): string;
urlFor(routeName: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): string;
urlFor(routeName: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, modelsD: RouteModel, options?: { queryParams: object }): string;
}
module '@ember/service' {
interface Registry {
'router': RouterService;
'router': EmberRoutingRouterService;
}
}
@ -1765,52 +1246,6 @@ declare module '@ember/error' {
export default Error;
}
declare module '@ember/routing/auto-location' {
import Ember from 'ember';
export default class AutoLocation extends Ember.AutoLocation { }
}
declare module '@ember/routing/hash-location' {
import Ember from 'ember';
export default class HashLocation extends Ember.HashLocation { }
}
declare module '@ember/routing/history-location' {
import Ember from 'ember';
export default class HistoryLocation extends Ember.HistoryLocation { }
}
declare module '@ember/routing/link-component' {
import Ember from 'ember';
export default class LinkComponent extends Ember.LinkComponent { }
}
declare module '@ember/routing/location' {
import Ember from 'ember';
const Location: typeof Ember.Location;
export default Location;
}
declare module '@ember/routing/none-location' {
import Ember from 'ember';
export default class NoneLocation extends Ember.NoneLocation { }
}
declare module '@ember/routing/route' {
import Ember from 'ember';
export default class Route extends Ember.Route { }
}
declare module '@ember/routing/router' {
import Ember from 'ember';
export default class EmberRouter extends Ember.Router { }
}
declare module '@ember/routing/router-service' {
import { RouterService } from 'ember';
export default class extends RouterService { }
}
declare module '@ember/runloop' {
import Ember from 'ember';
export const begin: typeof Ember.run.begin;

View File

@ -24,6 +24,8 @@
"@ember/array/*": ["ember__array/*"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/component": ["ember__component"],

View File

@ -1,6 +1,7 @@
import ContainerDebugAdapter from "@ember/debug/container-debug-adapter";
import EmberObject from "@ember/object";
// tslint:disable-next-line:strict-export-declare-modifiers
declare namespace DataAdapter {
interface Column {
name: string;
@ -25,7 +26,7 @@ declare namespace DataAdapter {
* The `DataAdapter` helps a data persistence library
* interface with tools that debug Ember such as Chrome and Firefox.
*/
declare class DataAdapter extends EmberObject {
export default class DataAdapter extends EmberObject {
/**
* The container-debug-adapter which is used
* to list all models.
@ -60,5 +61,3 @@ declare class DataAdapter extends EmberObject {
recordsRemoved: (idx: number, count: number) => void
): () => void;
}
export default DataAdapter;

View File

@ -0,0 +1,18 @@
export default class RouterDSL {
constructor(name: string, options: object);
route(name: string, callback: (this: RouterDSL) => void): void;
route(
name: string,
options?: { path?: string; resetNamespace?: boolean },
callback?: (this: RouterDSL) => void
): void;
mount(
name: string,
options?: {
as?: string,
path?: string,
resetNamespace?: boolean,
engineInfo?: any
}
): void;
}

View File

@ -0,0 +1,13 @@
export default interface Transition {
/**
* Aborts the Transition. Note you can also implicitly abort a transition
* by initiating another transition while a previous one is underway.
*/
abort(): Transition;
/**
* Retries a previously-aborted transition (making sure to abort the
* transition if it's still active). Returns a new transition that
* represents the new attempt to transition.
*/
retry(): Transition;
}

View File

@ -1,3 +1,6 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class AutoLocation extends Ember.AutoLocation { }
/**
* AutoLocation will select the best location option based off browser support with the priority order: history, hash, none.
*/
export default class AutoLocation extends EmberObject {}

View File

@ -1,3 +1,8 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class HashLocation extends Ember.HashLocation { }
/**
* `Ember.HashLocation` implements the location API using the browser's
* hash. At present, it relies on a `hashchange` event existing in the
* browser.
*/
export default class HashLocation extends EmberObject {}

View File

@ -1,3 +1,7 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class HistoryLocation extends Ember.HistoryLocation { }
/**
* Ember.HistoryLocation implements the location API using the browser's
* history.pushState API.
*/
export default class HistoryLocation extends EmberObject {}

View File

@ -6,3 +6,9 @@
export { default as Route } from '@ember/routing/route';
export { default as Router } from '@ember/routing/router';
import RouterService from '@ember/routing/router-service';
// tslint:disable-next-line:strict-export-declare-modifiers
interface Registry {
'router': RouterService;
}

View File

@ -1,3 +1,39 @@
import Ember from 'ember';
import Component from "@ember/component";
export default class LinkComponent extends Ember.LinkComponent { }
/**
* `Ember.LinkComponent` renders an element whose `click` event triggers a
* transition of the application's instance of `Ember.Router` to
* a supplied route by name.
*/
export default class LinkComponent extends Component {
/**
* Used to determine when this `LinkComponent` is active.
*/
currentWhen: any;
/**
* Sets the `title` attribute of the `LinkComponent`'s HTML element.
*/
title: string | null;
/**
* Sets the `rel` attribute of the `LinkComponent`'s HTML element.
*/
rel: string | null;
/**
* Sets the `tabindex` attribute of the `LinkComponent`'s HTML element.
*/
tabindex: string | null;
/**
* Sets the `target` attribute of the `LinkComponent`'s HTML element.
*/
target: string | null;
/**
* The CSS class to apply to `LinkComponent`'s element when its `active`
* property is `true`.
*/
activeClass: string;
/**
* Determines whether the `LinkComponent` will trigger routing via
* the `replaceWith` routing strategy.
*/
replace: boolean;
}

View File

@ -1,4 +1,13 @@
import Ember from 'ember';
export const Location: typeof Ember.Location;
/**
* Ember.Location returns an instance of the correct implementation of
* the `location` API.
*/
declare const Location: {
/**
* This is deprecated in favor of using the container to lookup the location
* implementation as desired.
* @deprecated Use the container to lookup the location implementation that you need.
*/
create(options?: {}): any;
};
export default Location;

View File

@ -1,3 +1,9 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class NoneLocation extends Ember.NoneLocation { }
/**
* Ember.NoneLocation does not interact with the browser. It is useful for
* testing, or when you need to manage state with your Router, but temporarily
* don't want it to muck with the URL (for example when you embed your
* application in a larger page).
*/
export default class NoneLocation extends EmberObject {}

View File

@ -1,3 +1,286 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
import ActionHandler from "@ember/object/-private/action-handler";
import Transition from "@ember/routing/-private/transition";
import Evented from "@ember/object/evented";
import { RenderOptions, RouteQueryParam } from "@ember/routing/types";
import Controller, { Registry as ControllerRegistry } from '@ember/controller';
export default class Route extends Ember.Route { }
/**
* The `Ember.Route` class is used to define individual routes. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
export default class Route extends EmberObject.extend(ActionHandler, Evented) {
// methods
/**
* This hook is called after this route's model has resolved.
* It follows identical async/promise semantics to `beforeModel`
* but is provided the route's resolved model in addition to
* the `transition`, and is therefore suited to performing
* logic that can only take place after the model has already
* resolved.
*/
afterModel(resolvedModel: any, transition: Transition): any;
/**
* This hook is the first of the route entry validation hooks
* called when an attempt is made to transition into a route
* or one of its children. It is called before `model` and
* `afterModel`, and is appropriate for cases when:
* 1) A decision can be made to redirect elsewhere without
* needing to resolve the model first.
* 2) Any async operations need to occur first before the
* model is attempted to be resolved.
* This hook is provided the current `transition` attempt
* as a parameter, which can be used to `.abort()` the transition,
* save it for a later `.retry()`, or retrieve values set
* on it from a previous hook. You can also just call
* `this.transitionTo` to another route to implicitly
* abort the `transition`.
* You can return a promise from this hook to pause the
* transition until the promise resolves (or rejects). This could
* be useful, for instance, for retrieving async code from
* the server that is required to enter a route.
*/
beforeModel(transition: Transition): any;
/**
* Returns the controller for a particular route or name.
* The controller instance must already have been created, either through entering the
* associated route or using `generateController`.
*/
controllerFor<K extends keyof ControllerRegistry>(name: K): ControllerRegistry[K];
/**
* Disconnects a view that has been rendered into an outlet.
*/
disconnectOutlet(options: string | { outlet?: string; parentView?: string }): void;
/**
* A hook you can implement to convert the URL into the model for
* this route.
*/
model(params: {}, transition: Transition): any;
/**
* Returns the model of a parent (or any ancestor) route
* in a route hierarchy. During a transition, all routes
* must resolve a model object, and if a route
* needs access to a parent route's model in order to
* resolve a model (or just reuse the model from a parent),
* it can call `this.modelFor(theNameOfParentRoute)` to
* retrieve it.
*/
modelFor(name: string): {};
/**
* Retrieves parameters, for current route using the state.params
* variable and getQueryParamsFor, using the supplied routeName.
*/
paramsFor(name: string): {};
/**
* Refresh the model on this route and any child routes, firing the
* `beforeModel`, `model`, and `afterModel` hooks in a similar fashion
* to how routes are entered when transitioning in from other route.
* The current route params (e.g. `article_id`) will be passed in
* to the respective model hooks, and if a different model is returned,
* `setupController` and associated route hooks will re-fire as well.
* An example usage of this method is re-querying the server for the
* latest information using the same parameters as when the route
* was first entered.
* Note that this will cause `model` hooks to fire even on routes
* that were provided a model object when the route was initially
* entered.
*/
redirect(): Transition;
/**
* Refresh the model on this route and any child routes, firing the
* `beforeModel`, `model`, and `afterModel` hooks in a similar fashion
* to how routes are entered when transitioning in from other route.
* The current route params (e.g. `article_id`) will be passed in
* to the respective model hooks, and if a different model is returned,
* `setupController` and associated route hooks will re-fire as well.
* An example usage of this method is re-querying the server for the
* latest information using the same parameters as when the route
* was first entered.
* Note that this will cause `model` hooks to fire even on routes
* that were provided a model object when the route was initially
* entered.
*/
refresh(): Transition;
/**
* `render` is used to render a template into a region of another template
* (indicated by an `{{outlet}}`). `render` is used both during the entry
* phase of routing (via the `renderTemplate` hook) and later in response to
* user interaction.
*/
render(name: string, options?: RenderOptions): void;
/**
* A hook you can use to render the template for the current route.
* This method is called with the controller for the current route and the
* model supplied by the `model` hook. By default, it renders the route's
* template, configured with the controller for the route.
* This method can be overridden to set up and render additional or
* alternative templates.
*/
renderTemplate(controller: Controller, model: {}): void;
/**
* Transition into another route while replacing the current URL, if possible.
* This will replace the current history entry instead of adding a new one.
* Beside that, it is identical to `transitionTo` in all other respects. See
* 'transitionTo' for additional information regarding multiple models.
*/
replaceWith(name: string, ...args: any[]): Transition;
/**
* A hook you can use to reset controller values either when the model
* changes or the route is exiting.
*/
resetController(controller: Controller, isExiting: boolean, transition: any): void;
/**
* Sends an action to the router, which will delegate it to the currently active
* route hierarchy per the bubbling rules explained under actions.
*/
send(name: string, ...args: any[]): void;
/**
* A hook you can implement to convert the route's model into parameters
* for the URL.
*
* The default `serialize` method will insert the model's `id` into the
* route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'.
* If the route has multiple dynamic segments or does not contain '_id', `serialize`
* will return `Ember.getProperties(model, params)`
* This method is called when `transitionTo` is called with a context
* in order to populate the URL.
*/
serialize(model: {}, params: string[]): string | object;
/**
* A hook you can use to setup the controller for the current route.
* This method is called with the controller for the current route and the
* model supplied by the `model` hook.
* By default, the `setupController` hook sets the `model` property of
* the controller to the `model`.
* If you implement the `setupController` hook in your Route, it will
* prevent this default behavior. If you want to preserve that behavior
* when implementing your `setupController` function, make sure to call
* `_super`
*/
setupController(controller: Controller, model: {}): void;
/**
* Transition the application into another route. The route may
* be either a single route or route path
*/
transitionTo(name: string, ...object: any[]): Transition;
/**
* The name of the view to use by default when rendering this routes template.
* When rendering a template, the route will, by default, determine the
* template and view to use from the name of the route itself. If you need to
* define a specific view, set this property.
* This is useful when multiple routes would benefit from using the same view
* because it doesn't require a custom `renderTemplate` method.
*/
transitionTo(name: string, ...object: any[]): Transition;
// https://emberjs.com/api/ember/3.2/classes/Route/methods/intermediateTransitionTo?anchor=intermediateTransitionTo
/**
* Perform a synchronous transition into another route without attempting to resolve promises,
* update the URL, or abort any currently active asynchronous transitions
* (i.e. regular transitions caused by transitionTo or URL changes).
*
* @param name the name of the route or a URL
* @param object the model(s) or identifier(s) to be used while
* transitioning to the route.
* @returns the Transition object associated with this attempted transition
*/
intermediateTransitionTo(name: string, ...object: any[]): Transition;
// properties
/**
* The controller associated with this route.
*/
controller: Controller;
/**
* The name of the controller to associate with this route.
* By default, Ember will lookup a route's controller that matches the name
* of the route (i.e. `App.PostController` for `App.PostRoute`). However,
* if you would like to define a specific controller to use, you can do so
* using this property.
* This is useful in many ways, as the controller specified will be:
* * p assed to the `setupController` method.
* * used as the controller for the view being rendered by the route.
* * returned from a call to `controllerFor` for the route.
*/
controllerName: string;
/**
* Configuration hash for this route's queryParams.
*/
queryParams: { [key: string]: RouteQueryParam };
/**
* The name of the route, dot-delimited
*/
routeName: string;
/**
* The name of the template to use by default when rendering this routes
* template.
* This is similar with `viewName`, but is useful when you just want a custom
* template without a view.
*/
templateName: string;
// events
/**
* This hook is executed when the router enters the route. It is not executed
* when the model for the route changes.
*/
activate(): void;
/**
* This hook is executed when the router completely exits this route. It is
* not executed when the model for the route changes.
*/
deactivate(): void;
/**
* The didTransition action is fired after a transition has successfully been
* completed. This occurs after the normal model hooks (beforeModel, model,
* afterModel, setupController) have resolved. The didTransition action has
* no arguments, however, it can be useful for tracking page views or resetting
* state on the controller.
*/
didTransition(): void;
/**
* When attempting to transition into a route, any of the hooks may return a promise
* that rejects, at which point an error action will be fired on the partially-entered
* routes, allowing for per-route error handling logic, or shared error handling logic
* defined on a parent route.
*/
error(error: any, transition: Transition): void;
/**
* The loading action is fired on the route when a route's model hook returns a
* promise that is not already resolved. The current Transition object is the first
* parameter and the route that triggered the loading event is the second parameter.
*/
loading(transition: Transition, route: Route): void;
/**
* The willTransition action is fired at the beginning of any attempted transition
* with a Transition object as the sole argument. This action can be used for aborting,
* redirecting, or decorating the transition from the currently active routes.
*/
willTransition(transition: Transition): void;
}

View File

@ -1,3 +1,215 @@
import { RouterService } from 'ember';
import Transition from '@ember/routing/-private/transition';
import Service from '@ember/service';
export default class extends RouterService { }
// tslint:disable-next-line:strict-export-declare-modifiers
type RouteModel = object | string | number;
// https://emberjs.com/api/ember/2.18/classes/RouterService
/**
* The Router service is the public API that provides component/view layer access to the router.
*/
export default class RouterService extends Service {
//
/**
* Name of the current route.
* This property represent the logical name of the route,
* which is comma separated.
* For the following router:
* ```app/router.js
* Router.map(function() {
* this.route('about');
* this.route('blog', function () {
* this.route('post', { path: ':post_id' });
* });
* });
* ```
* It will return:
* * `index` when you visit `/`
* * `about` when you visit `/about`
* * `blog.index` when you visit `/blog`
* * `blog.post` when you visit `/blog/some-post-id`
*/
readonly currentRouteName: string;
//
/**
* Current URL for the application.
* This property represent the URL path for this route.
* For the following router:
* ```app/router.js
* Router.map(function() {
* this.route('about');
* this.route('blog', function () {
* this.route('post', { path: ':post_id' });
* });
* });
* ```
* It will return:
* * `/` when you visit `/`
* * `/about` when you visit `/about`
* * `/blog` when you visit `/blog`
* * `/blog/some-post-id` when you visit `/blog/some-post-id`
*/
readonly currentURL: string;
//
/**
* Determines whether a route is active.
*
* @param routeName the name of the route
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route
* @param options optional hash with a queryParams property containing a
* mapping of query parameters
*/
isActive(routeName: string, options?: { queryParams: object }): boolean;
isActive(
routeName: string,
models: RouteModel,
options?: { queryParams: object }
): boolean;
isActive(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): boolean;
isActive(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): boolean;
isActive(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): boolean;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=replaceWith
/**
* Transition into another route while replacing the current URL, if
* possible. The route may be either a single route or route path.
*
* @param routeNameOrUrl the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property
* containing a mapping of query parameters
* @returns the Transition object associated with this attempted transition
*/
replaceWith(
routeNameOrUrl: string,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
models: RouteModel,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): Transition;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=transitionTo
/**
* Transition the application into another route. The route may be
* either a single route or route path
*
* @param routeNameOrUrl the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property
* containing a mapping of query parameters
* @returns the Transition object associated with this attempted transition
*/
transitionTo(
routeNameOrUrl: string,
options?: { queryParam: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
models: RouteModel,
options?: { queryParams: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): Transition;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=urlFor
/**
* Generate a URL based on the supplied route name.
*
* @param routeName the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property containing
* a mapping of query parameters
* @returns the string representing the generated URL
*/
urlFor(routeName: string, options?: { queryParams: object }): string;
urlFor(
routeName: string,
models: RouteModel,
options?: { queryParams: object }
): string;
urlFor(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): string;
urlFor(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): string;
urlFor(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): string;
}

View File

@ -1,3 +1,51 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
import Evented from "@ember/object/evented";
import RouterDSL from "@ember/routing/-private/router-dsl";
import Transition from "@ember/routing/-private/transition";
import RouterService from "@ember/routing/router-service";
export default class EmberRouter extends Ember.Router { }
/**
* The `Ember.Router` class manages the application state and URLs. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
export default class Router extends EmberObject.extend(Evented) {
/**
* The `Router.map` function allows you to define mappings from URLs to routes
* in your application. These mappings are defined within the
* supplied callback function using `this.route`.
*/
static map(callback: (this: RouterDSL) => void): void;
/**
* The `location` property determines the type of URL's that your
* application will use.
*/
location: string;
/**
* Represents the URL of the root of the application, often '/'. This prefix is
* assumed on all routes defined on this router.
*/
rootURL: string;
/**
* Handles updating the paths and notifying any listeners of the URL
* change.
*/
didTransition(): any;
/**
* Handles notifying any listeners of an impending URL
* change.
*/
willTransition(): any;
/**
* Transition the application into another route. The route may
* be either a single route or route path:
*/
transitionTo(name: string, options?: {}): Transition;
transitionTo(name: string, ...models: any[]): Transition;
transitionTo(name: string, options: {}): Transition;
}
declare module '@ember/service' {
interface Registry {
'router': RouterService;
}
}

View File

@ -1,21 +1,21 @@
import Route from '@ember/routing/route';
import Array from '@ember/array';
import Ember from 'ember'; // currently needed for Transition
import EmberObject from '@ember/object';
import Controller from '@ember/controller';
import Transition from '@ember/routing/-private/transition';
class Post extends EmberObject {}
interface Posts extends Array<Post> {}
Route.extend({
beforeModel(transition: Ember.Transition) {
beforeModel(transition: Transition) {
this.transitionTo('someOtherRoute');
},
});
Route.extend({
afterModel(posts: Posts, transition: Ember.Transition) {
afterModel(posts: Posts, transition: Transition) {
if (posts.length === 1) {
this.transitionTo('post.show', posts.firstObject);
}
@ -39,7 +39,7 @@ Route.extend({
},
});
Ember.Route.extend({
Route.extend({
model() {
return this.modelFor('post');
},
@ -61,7 +61,7 @@ Route.extend({
});
Route.extend({
renderTemplate(controller: Ember.Controller, model: {}) {
renderTemplate(controller: Controller, model: {}) {
this.render('posts', {
view: 'someView', // the template to render, referenced by name
into: 'application', // the template to render into, referenced by name
@ -73,7 +73,7 @@ Route.extend({
});
Route.extend({
resetController(controller: Ember.Controller, isExiting: boolean, transition: boolean) {
resetController(controller: Controller, isExiting: boolean, transition: boolean) {
if (isExiting) {
// controller.set('page', 1);
}

View File

@ -1,7 +1,9 @@
import Ember from 'ember';
import { assertType } from './lib/assert';
import Router from '@ember/routing/router';
import Service, { inject as service } from '@ember/service';
import EmberObject, { get } from '@ember/object';
const AppRouter = Ember.Router.extend({
const AppRouter = Router.extend({
});
AppRouter.map(function() {
@ -24,31 +26,31 @@ AppRouter.map(function() {
this.mount('my-engine', { as: 'some-other-engine', path: '/some-other-engine'});
});
const RouterServiceConsumer = Ember.Service.extend({
router: Ember.inject.service('router'),
const RouterServiceConsumer = Service.extend({
router: service('router'),
currentRouteName() {
const x: string = Ember.get(this, 'router').currentRouteName;
const x: string = get(this, 'router').currentRouteName;
},
currentURL() {
const x: string = Ember.get(this, 'router').currentURL;
const x: string = get(this, 'router').currentURL;
},
transitionWithoutModel() {
Ember.get(this, 'router')
get(this, 'router')
.transitionTo('some-route');
},
transitionWithModel() {
const model = Ember.Object.create();
Ember.get(this, 'router')
const model = EmberObject.create();
get(this, 'router')
.transitionTo('some.other.route', model);
},
transitionWithMultiModel() {
const model = Ember.Object.create();
Ember.get(this, 'router')
const model = EmberObject.create();
get(this, 'router')
.transitionTo('some.other.route', model, model);
},
transitionWithModelAndOptions() {
const model = Ember.Object.create();
Ember.get(this, 'router')
const model = EmberObject.create();
get(this, 'router')
.transitionTo('index', model, { queryParams: { search: 'ember' }});
}
});

View File

@ -19,6 +19,10 @@
"@ember/object/*": ["ember__object/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/service": ["ember__service"],
"@ember/service/*": ["ember__service/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"]
@ -38,6 +42,9 @@
"route.d.ts",
"router-service.d.ts",
"router.d.ts",
"types.d.ts",
"-private/router-dsl.d.ts",
"-private/transition.d.ts",
"test/lib/assert.ts",
"test/route.ts",
"test/router.ts"

13
types/ember__routing/types.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
export interface RenderOptions {
into?: string;
controller?: string;
model?: any;
outlet?: string;
view?: string;
}
export interface RouteQueryParam {
refreshModel?: boolean;
replace?: boolean;
as?: string;
}