Skip to content

Commit d7b3f9d

Browse files
authored
Merge pull request #20288 from emberjs/stabilize-owner-types
[FEATURE] Stable types for `@ember/owner`
2 parents cc92bc9 + d580037 commit d7b3f9d

File tree

115 files changed

+339
-809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+339
-809
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ dist/
77
tmp/
88
smoke-tests/
99
types/
10-
type-tests/preview
10+
type-tests/

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ jobs:
4343
cache: yarn
4444
- name: install dependencies
4545
run: yarn install --frozen-lockfile --non-interactive
46-
- name: Check types
47-
run: yarn type-check
46+
- name: build stable type definitions
47+
run: yarn build:types
48+
- name: Check published types
49+
run: yarn type-check:types
4850

4951
types-range:
5052
name: Type Checking (other supported versions)
@@ -61,10 +63,12 @@ jobs:
6163
cache: yarn
6264
- name: install dependencies
6365
run: yarn install --frozen-lockfile --non-interactive
66+
- name: build stable type definitions
67+
run: yarn build:types
6468
- name: install TS@${{matrix.ts-version}}
6569
run: yarn add -D typescript@${{ matrix.ts-version }}
66-
- name: Check types with TS@${{matrix.ts-version}}
67-
run: yarn type-check
70+
- name: Check published types with TS@${{matrix.ts-version}}
71+
run: yarn type-check:types
6872

6973
basic-test:
7074
name: Debug and Prebuilt (All Tests by Package + Canary Features)

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
"url": "git+https://github.com/emberjs/ember.js.git"
3434
},
3535
"scripts": {
36-
"build": "ember build --environment production",
36+
"build:js": "ember build --environment production",
37+
"build:types": "node types/publish.mjs",
38+
"build": "npm-run-all build:*",
3739
"docs": "ember ember-cli-yuidoc",
38-
"types": "node types/publish.mjs",
3940
"link:glimmer": "node bin/yarn-link-glimmer.js",
4041
"start": "ember serve",
4142
"lint": "npm-run-all --continue-on-error --aggregate-output --parallel \"lint:!(fix)\"",
@@ -49,8 +50,8 @@
4950
"test:blueprints": "yarn test:blueprints:js && yarn test:blueprints:ts",
5051
"test:node": "qunit tests/node/**/*-test.js",
5152
"test:browserstack": "node bin/run-browserstack-tests.js",
52-
"type-check:stable": "tsc --noEmit",
53-
"type-check:preview": "tsc --noEmit --project type-tests/preview",
53+
"type-check:internals": "tsc --noEmit",
54+
"type-check:types": "tsc --noEmit --project type-tests",
5455
"type-check": "npm-run-all type-check:*"
5556
},
5657
"dependencies": {

packages/@ember/owner/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// We need to provide a narrower public interface to `getOwner` so that we only
3434
// expose the `Owner` type, *not* our richer `InternalOwner` type and its
3535
// various bits of private API.
36-
import Owner, { getOwner as internalGetOwner } from '../-internals/owner';
36+
import Owner, { getOwner as internalGetOwner } from '@ember/-internals/owner';
3737

3838
// NOTE: this documentation appears here instead of at the definition site so
3939
// it can appear correctly in both API docs and for TS, while providing a richer
@@ -99,4 +99,4 @@ export {
9999
KnownForTypeResult,
100100
Resolver,
101101
DIRegistry,
102-
} from '../-internals/owner';
102+
} from '@ember/-internals/owner';

type-tests/preview/@ember/application-test/application-instance.ts renamed to type-tests/@ember/application-test/application-instance.ts

File renamed without changes.
File renamed without changes.

type-tests/preview/@ember/application-test/index.ts renamed to type-tests/@ember/application-test/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import Owner from '@ember/owner';
44
import ApplicationInstance from '@ember/application/instance';
55
import Service from '@ember/service';
66
import { expectTypeOf } from 'expect-type';
7+
import { getOwner as getOwnerProper, setOwner as setOwnerProper } from '@ember/owner';
8+
9+
expectTypeOf(getOwner).toEqualTypeOf(getOwnerProper);
10+
expectTypeOf(setOwner).toEqualTypeOf(setOwnerProper);
711

812
expectTypeOf(getOwner({})).toEqualTypeOf<Owner | undefined>();
913

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)