Skip to content

Commit

Permalink
FEATURE: Automatically include Ember's own types
Browse files Browse the repository at this point in the history
- In TS, add an `import 'ember-source/types'` statement.
- In JS, add a `/** @typedef {import('ember-source/types')} */` comment.
  • Loading branch information
chriskrycho committed May 11, 2023
1 parent b9bec54 commit e95e918
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions blueprints/addon/files/local-types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<% if (typescript) { %>
// This "side-effect"-type import provides auto-complete, go-to-def, etc. for
// Ember's internals throughout your application, so don't remove it!
import 'ember-source/types';
<% } else { %>
// This "type definition" import comment provides auto-complete, go-to-def, etc.
// for Ember's internals throughout your application, so don't remove it, even
// if you do not use TypeScript at all.
/**
@typedef {import('ember-source/types')} Types
*/
<% } %>
12 changes: 12 additions & 0 deletions blueprints/app/files/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ export default class App extends Application {
}

loadInitializers(App, config.modulePrefix);

<% if (typescript) { %>
// This "side-effect"-type import provides auto-complete, go-to-def, etc. for
// Ember's internals throughout your application, so don't remove it!
import 'ember-source/types';
<% } else { %>
// This "type definition" import comment provides auto-complete, go-to-def, etc.
// for Ember's internals throughout your application, so don't remove it!
/**
@typedef {import('ember-source/types')} Types
*/
<% } %>

0 comments on commit e95e918

Please sign in to comment.