question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[@ember/routing] private namespacing

See original GitHub issue

Cross post from https://github.com/DefinitelyTyped/DefinitelyTyped/issues/37323

Which package(s) does this problem pertain to?

What are instructions we can follow to reproduce the issue?

ember new sample; cd ./sample # Create a new ember app
ember install ember-cli-typescript # Set up typescript support

Try to add types for the beforeModel hook in a route with the transition argument

beforeModel(this: EditRoute, transition: Transition)

Observe that the transition types are imported from:

import Transition from '@ember/routing/-private/transition'

Can this be exported in a public space since this is a public API?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
chriskrychocommented, Aug 5, 2019

Thanks for filing this! Since its existence and methods are public API, I agree that the interface should be importable. We want to make sure that only an interface is importable so that the types represent the design of the actual type, which is that it is not available to import as a class and is therefore not open for arbitrary extension e.g. via sub-classing.

Any objections to exporting under those terms @jamescdavis @dfreeman @mike-north?

0reactions
MrChocolatinecommented, Feb 15, 2021

This is sensibly the same thing but check out the documentation: https://docs.ember-cli-typescript.com/ember/routes

Basically, both recommend to reuse what is returned by public methods. That way you can’t be wrong since you get exactly what it is used internally:

import type RouterService from '@ember/routing/router-service';
type Transition = ReturnType<RouterService['transitionTo']>;
Read more comments on GitHub >

github_iconTop Results From Across the Web

EmberRouter - 4.9 - Ember API Documentation
Defines the properties that will be concatenated from the superclass (instead of overridden). By default, when you extend an Ember class a property...
Read more >
Ember.AutoLocation
PRIVATE. Defined in: packages/ember-routing/lib/location/auto_location.js:25. Module: ember-routing. Ember.AutoLocation will select the best location option ...
Read more >
How to use the ember-runtime/system/object.extend function ...
It uses the unknownProperty handler to automatically create EachArray instances for property names. @private @class EachProxy @namespace Ember @extends Ember.
Read more >
Ember routing and applicationController used in connectOutlet
I have this working example fiddle of ember routing ... use several application namespaces (You just have to avoid nesting them in the...
Read more >
create-private-dns-namespace - AWS Documentation
Creates a private namespace based on DNS, which is visible only inside a specified Amazon VPC. The namespace defines your service naming scheme....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found