@angular-wave/angular.ts 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,11 +28,11 @@ import { createInjector } from "./core/di/injector.js";
28
28
  import { wait } from "./shared/test-utils.js";
29
29
 
30
30
  describe("angular", () => {
31
- let element, document, module, injector, $rootScope, $compile;
31
+ let element, document, module, injector, $rootScope, $compile, angular;
32
32
 
33
33
  beforeEach(() => {
34
- window.angular = new Angular();
35
- module = window.angular.module("defaultModule", ["ng"]);
34
+ angular = new Angular();
35
+ module = angular.module("defaultModule", ["ng"]);
36
36
  injector = createInjector(["ng", "defaultModule"]);
37
37
  $rootScope = injector.get("$rootScope");
38
38
  $compile = injector.get("$compile");
@@ -1026,7 +1026,7 @@ describe("angular", () => {
1026
1026
  describe("module loader", () => {
1027
1027
  let angular;
1028
1028
  beforeEach(() => {
1029
- angular = window.angular = new Angular();
1029
+ angular = new Angular();
1030
1030
  });
1031
1031
 
1032
1032
  it("allows registering a module", () => {
@@ -333,7 +333,7 @@ export class CompileProvider {
333
333
  /**
334
334
  * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
335
335
  * or an object map of components where the keys are the names and the values are the component definition objects.
336
- * @param {Object} options Component definition object (a simplified
336
+ * @param {import("../../interface.js").ComponentOptions} options Component definition object (a simplified
337
337
  * {directive definition object}),
338
338
  * with the following properties (all optional):
339
339
  *
@@ -101,7 +101,7 @@ export class NgModule {
101
101
 
102
102
  /**
103
103
  * @param {string} name
104
- * @param {import("../../interface.js").Injectable} options
104
+ * @param {import("../../interface.js").ComponentOptions} options
105
105
  * @returns {NgModule}
106
106
  */
107
107
  component(name, options) {
package/src/interface.ts CHANGED
@@ -38,14 +38,15 @@ export type ExpandoStore = {
38
38
  */
39
39
  export type AnnotatedFactory = [...string[], (...args: any[]) => any];
40
40
  export type InjectableFactory = (...args: any[]) => any;
41
+ export type InjectableClass = new (...args: any[]) => any;
41
42
 
42
43
  /**
43
- * A factory that can be either a standalone function or a dependency-annotated array.
44
+ * A factory that can be either a standalone function or a dependency-annotated array or a class (constructor function).
44
45
  *
45
46
  * The array form is used to support minification-safe dependency injection.
46
47
  * See {@link AnnotatedFactory}.
47
48
  */
48
- export type Injectable = AnnotatedFactory | InjectableFactory;
49
+ export type Injectable = AnnotatedFactory | InjectableFactory | InjectableClass;
49
50
 
50
51
  /**
51
52
  * An object that defines how a service is constructed.
@@ -13,7 +13,7 @@ describe("errors", () => {
13
13
  const e = new Error();
14
14
  return isDefined(e.stack);
15
15
  };
16
- const emptyTestError = minErr();
16
+ const emptyTestError = minErr("");
17
17
  const testError = minErr("test");
18
18
 
19
19
  it("should return an Error factory", () => {
@@ -10,7 +10,6 @@ describe("urlUtils", () => {
10
10
  it("should returned already parsed URLs unchanged", () => {
11
11
  const urlObj = urlResolve("/foo?bar=baz#qux");
12
12
  expect(urlResolve(urlObj)).toBe(urlObj);
13
- expect(urlResolve(true)).toBe(true);
14
13
  expect(urlResolve(null)).toBeNull();
15
14
  expect(urlResolve(undefined)).toBeUndefined();
16
15
  });
@@ -123,22 +123,22 @@ describe("api", () => {
123
123
  });
124
124
 
125
125
  it("uses preassigned $$hashKey", () => {
126
- expect(hashKey({ $$hashKey: 42 })).toEqual(42);
126
+ expect(hashKey({ $$hashKey: "42" })).toEqual("42");
127
127
  });
128
128
 
129
129
  it("supports a function $$hashKey", function () {
130
- expect(hashKey({ $$hashKey: () => 42 })).toEqual(42);
130
+ expect(hashKey({ $$hashKey: () => "42" })).toEqual("42");
131
131
  });
132
132
 
133
133
  it("calls the function $$hashKey as a method with the correct this", () => {
134
134
  expect(
135
135
  hashKey({
136
- myKey: 42,
136
+ myKey: "42",
137
137
  $$hashKey: function () {
138
138
  return this.myKey;
139
139
  },
140
140
  }),
141
- ).toEqual(42);
141
+ ).toEqual("42");
142
142
  });
143
143
  });
144
144
 
package/tsconfig.json CHANGED
@@ -15,11 +15,5 @@
15
15
  "typeRoots": ["node_modules/@types"]
16
16
  },
17
17
  "include": ["src"],
18
- "exclude": [
19
- "**/*.d.ts",
20
- "node_modules",
21
- "types/**",
22
- "**/*.test.js",
23
- "**/*.spec.js"
24
- ]
18
+ "exclude": ["**/*.d.ts", "node_modules", "**/*.spec.js", "**/*.test.js"]
25
19
  }