static-injector 6.1.2 → 6.2.0

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.
Files changed (39) hide show
  1. package/import/di/contextual.d.ts +4 -0
  2. package/import/di/forward_ref.d.ts +1 -1
  3. package/import/di/injectable.d.ts +4 -3
  4. package/import/di/injection_token.d.ts +3 -0
  5. package/import/di/injector.d.ts +2 -0
  6. package/import/di/injector_compatibility.d.ts +0 -1
  7. package/import/di/interface/provider.d.ts +11 -11
  8. package/import/di/metadata.d.ts +2 -2
  9. package/import/di/r3_injector.d.ts +8 -1
  10. package/import/error_handler.d.ts +3 -0
  11. package/import/errors.d.ts +7 -1
  12. package/import/index.d.ts +1 -0
  13. package/import/linker/destroy_ref.d.ts +12 -0
  14. package/import/pending_tasks.d.ts +3 -0
  15. package/import/render3/errors_di.d.ts +12 -2
  16. package/import/render3/reactivity/api.d.ts +2 -0
  17. package/import/render3/reactivity/asserts.d.ts +1 -1
  18. package/import/render3/reactivity/computed.d.ts +1 -0
  19. package/import/render3/reactivity/effect.d.ts +9 -8
  20. package/import/render3/reactivity/linked_signal.d.ts +3 -0
  21. package/import/render3/reactivity/signal.d.ts +1 -0
  22. package/import/render3/reactivity/untracked.d.ts +1 -0
  23. package/import/resource/api.d.ts +7 -4
  24. package/import/resource/resource.d.ts +6 -3
  25. package/index.js +259 -185
  26. package/index.js.map +4 -4
  27. package/index.mjs +259 -184
  28. package/index.mjs.map +4 -4
  29. package/package.json +2 -2
  30. package/primitives/di/index.d.ts +2 -1
  31. package/primitives/di/src/injection_token.d.ts +9 -0
  32. package/primitives/di/src/injector.d.ts +2 -1
  33. package/primitives/signals/index.d.ts +4 -2
  34. package/primitives/signals/src/effect.d.ts +26 -0
  35. package/primitives/signals/src/formatter.d.ts +18 -0
  36. package/primitives/signals/src/graph.d.ts +42 -35
  37. package/primitives/signals/src/linked_signal.d.ts +3 -2
  38. package/primitives/signals/src/watch.d.ts +0 -1
  39. package/readme.md +1 -1
@@ -14,6 +14,8 @@ import type { Injector } from './injector';
14
14
  * from the given `Injector`. Note that `inject` is only usable synchronously, and cannot be used in
15
15
  * any asynchronous callbacks or after any `await` points.
16
16
  *
17
+ * @see [Run within an injection context](guide/di/dependency-injection-context#run-within-an-injection-context)
18
+ *
17
19
  * @param injector the injector which will satisfy calls to [`inject`](api/core/inject) while `fn`
18
20
  * is executing
19
21
  * @param fn the closure to be run in the context of `injector`
@@ -31,6 +33,8 @@ export declare function isInInjectionContext(): boolean;
31
33
  *
32
34
  * @param debugFn a reference to the function making the assertion (used for the error message).
33
35
  *
36
+ * @see [Asserts the context](guide/di/dependency-injection-context#asserts-the-context)
37
+ *
34
38
  * @publicApi
35
39
  */
36
40
  export declare function assertInInjectionContext(debugFn: Function): void;
@@ -56,7 +56,7 @@ export interface ForwardRefFn {
56
56
  * hideParent = input.required<boolean>();
57
57
  * }
58
58
  * ```
59
- *
59
+ * @see [Resolve circular dependencies with a forward reference](guide/di/di-in-action#resolve-circular-dependencies-with-a-forward-reference)
60
60
  * @publicApi
61
61
  */
62
62
  export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>;
@@ -25,7 +25,8 @@ export interface InjectableDecorator {
25
25
  * provided and injected as a dependency.
26
26
  *
27
27
  * @see [Introduction to Services and DI](guide/di)
28
- * @see [Dependency Injection Guide](guide/di/dependency-injection
28
+ * @see [Creating and using services](guide/di/creating-and-using-services)
29
+ * @see [Defining dependency providers](guide/di/defining-dependency-providers)
29
30
  *
30
31
  * @usageNotes
31
32
  *
@@ -51,6 +52,7 @@ export interface InjectableDecorator {
51
52
  /**
52
53
  * Type of the Injectable metadata.
53
54
  *
55
+ *
54
56
  * @publicApi
55
57
  */
56
58
  export interface Injectable {
@@ -60,8 +62,7 @@ export interface Injectable {
60
62
  * - `Type<any>` - associates the injectable with an `@NgModule` or other `InjectorType`. This
61
63
  * option is DEPRECATED.
62
64
  * - 'null' : Equivalent to `undefined`. The injectable is not provided in any scope automatically
63
- * and must be added to a `providers` array of an [@NgModule](api/core/NgModule#providers),
64
- * [@Component](api/core/Directive#providers) or [@Directive](api/core/Directive#providers).
65
+ * and must be added to a `providers` array.
65
66
  *
66
67
  * The following options specify that this injectable should be provided in one of the following
67
68
  * injectors:
@@ -52,6 +52,9 @@ import { Type } from '../interface/type';
52
52
  *
53
53
  * {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}
54
54
  *
55
+ *
56
+ * @see [What is an InjectionToken?](guide/di/defining-dependency-providers#what-is-an-injectiontoken)
57
+ *
55
58
  * @publicApi
56
59
  */
57
60
  export declare class InjectionToken<T> {
@@ -30,6 +30,8 @@ import { ProviderToken } from './provider_token';
30
30
  *
31
31
  * {@example core/di/ts/injector_spec.ts region='injectInjector'}
32
32
  *
33
+ * @see [Types of injector hierarchies](guide/di/hierarchical-dependency-injection#types-of-injector-hierarchies)
34
+ *
33
35
  * @publicApi
34
36
  */
35
37
  export declare abstract class Injector {
@@ -108,5 +108,4 @@ export declare function attachInjectFlag(decorator: any, flag: InternalInjectFla
108
108
  * @param token Token that may contain monkey-patched DI flags property.
109
109
  */
110
110
  export declare function getInjectFlag(token: any): number | undefined;
111
- export declare function catchInjectorError(e: any, token: any, injectorErrorName: string, source: string | null): never;
112
111
  export declare function formatError(text: string, obj: any, injectorErrorName: string, source?: string | null): string;
@@ -20,7 +20,7 @@ export interface ValueSansProvider {
20
20
  }
21
21
  /**
22
22
  * Configures the `Injector` to return a value for a token.
23
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
23
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
24
24
  *
25
25
  * @usageNotes
26
26
  *
@@ -65,7 +65,7 @@ export interface StaticClassSansProvider {
65
65
  }
66
66
  /**
67
67
  * Configures the `Injector` to return an instance of `useClass` for a token.
68
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
68
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
69
69
  *
70
70
  * @usageNotes
71
71
  *
@@ -95,7 +95,7 @@ export interface StaticClassProvider extends StaticClassSansProvider {
95
95
  /**
96
96
  * Configures the `Injector` to return an instance of a token.
97
97
  *
98
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
98
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
99
99
  *
100
100
  * @usageNotes
101
101
  *
@@ -115,7 +115,7 @@ export interface ConstructorSansProvider {
115
115
  /**
116
116
  * Configures the `Injector` to return an instance of a token.
117
117
  *
118
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
118
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
119
119
  *
120
120
  * @usageNotes
121
121
  *
@@ -142,7 +142,7 @@ export interface ConstructorProvider extends ConstructorSansProvider {
142
142
  * Configures the `Injector` to return a value of another `useExisting` token.
143
143
  *
144
144
  * @see {@link ExistingProvider}
145
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
145
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
146
146
  *
147
147
  * @publicApi
148
148
  */
@@ -155,7 +155,7 @@ export interface ExistingSansProvider {
155
155
  /**
156
156
  * Configures the `Injector` to return a value of another `useExisting` token.
157
157
  *
158
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
158
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
159
159
  *
160
160
  * @usageNotes
161
161
  *
@@ -182,7 +182,7 @@ export interface ExistingProvider extends ExistingSansProvider {
182
182
  * Configures the `Injector` to return a value by invoking a `useFactory` function.
183
183
  *
184
184
  * @see {@link FactoryProvider}
185
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
185
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
186
186
  *
187
187
  * @publicApi
188
188
  */
@@ -200,7 +200,7 @@ export interface FactorySansProvider {
200
200
  }
201
201
  /**
202
202
  * Configures the `Injector` to return a value by invoking a `useFactory` function.
203
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
203
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
204
204
  *
205
205
  * @usageNotes
206
206
  *
@@ -257,7 +257,7 @@ export interface TypeProvider extends Type<any> {
257
257
  * Configures the `Injector` to return a value by invoking a `useClass` function.
258
258
  * Base for `ClassProvider` decorator.
259
259
  *
260
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
260
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
261
261
  *
262
262
  * @publicApi
263
263
  */
@@ -269,7 +269,7 @@ export interface ClassSansProvider {
269
269
  }
270
270
  /**
271
271
  * Configures the `Injector` to return an instance of `useClass` for a token.
272
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
272
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
273
273
  *
274
274
  * @usageNotes
275
275
  *
@@ -298,7 +298,7 @@ export interface ClassProvider extends ClassSansProvider {
298
298
  }
299
299
  /**
300
300
  * Describes how the `Injector` should be configured.
301
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
301
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
302
302
  *
303
303
  * @see {@link StaticProvider}
304
304
  *
@@ -31,7 +31,7 @@ export interface InjectDecorator {
31
31
  *
32
32
  * {@example core/di/ts/metadata_spec.ts region='InjectWithoutDecorator'}
33
33
  *
34
- * @see [Dependency Injection Guide](guide/di/dependency-injection
34
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
35
35
  *
36
36
  */
37
37
  (token: any): any;
@@ -75,7 +75,7 @@ export interface OptionalDecorator {
75
75
  *
76
76
  * {@example core/di/ts/metadata_spec.ts region='Optional'}
77
77
  *
78
- * @see [Dependency Injection Guide](guide/di/dependency-injection.
78
+ * @see [Dependency Injection Guide](guide/di/dependency-injection)
79
79
  */
80
80
  (): any;
81
81
  new (): Optional;
@@ -5,6 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
+ import { Type } from '../interface/type';
8
9
  import type { Injector } from './injector';
9
10
  import { InjectorType } from './interface/defs';
10
11
  import { InjectOptions } from './interface/injector';
@@ -18,6 +19,8 @@ export declare function getNullInjector(): Injector;
18
19
  * An `Injector` that's part of the environment injector hierarchy, which exists outside of the
19
20
  * component tree.
20
21
  *
22
+ * @see [Types of injector hierarchies](guide/di/hierarchical-dependency-injection#types-of-injector-hierarchies)
23
+ *
21
24
  * @publicApi
22
25
  */
23
26
  export declare abstract class EnvironmentInjector implements Injector {
@@ -59,6 +62,10 @@ export declare abstract class EnvironmentInjector implements Injector {
59
62
  */
60
63
  abstract runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
61
64
  abstract destroy(): void;
65
+ /**
66
+ * Indicates whether the instance has already been destroyed.
67
+ */
68
+ abstract get destroyed(): boolean;
62
69
  }
63
70
  export declare class R3Injector extends EnvironmentInjector implements PrimitivesInjector {
64
71
  readonly parent: Injector;
@@ -107,5 +114,5 @@ export declare class R3Injector extends EnvironmentInjector implements Primitive
107
114
  *
108
115
  * @param provider provider to convert to factory
109
116
  */
110
- export declare function providerToFactory(provider: SingleProvider, ngModuleType?: InjectorType<any>, providers?: any[]): () => any;
117
+ export declare function providerToFactory(provider: SingleProvider, ngModuleType?: InjectorType<any>, providers?: any[]): (type?: Type<unknown>, flags?: number) => any;
111
118
  export declare function assertNotDestroyed(injector: R3Injector): void;
@@ -36,6 +36,9 @@ import { InjectionToken } from './di/injection_token';
36
36
  * ```
37
37
  *
38
38
  * @publicApi
39
+ *
40
+ * @see [Unhandled errors in Angular](best-practices/error-handling)
41
+ *
39
42
  */
40
43
  export declare class ErrorHandler {
41
44
  handleError(error: any): void;
@@ -56,7 +56,7 @@ export declare const enum RuntimeErrorCode {
56
56
  INVALID_BINDING_TARGET = 316,
57
57
  INVALID_SET_INPUT_CALL = 317,
58
58
  MULTIPLE_PLATFORMS = 400,
59
- PLATFORM_NOT_FOUND = 401,
59
+ PLATFORM_NOT_FOUND = -401,
60
60
  MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP = 402,
61
61
  BOOTSTRAP_COMPONENTS_NOT_FOUND = -403,
62
62
  PLATFORM_ALREADY_DESTROYED = 404,
@@ -76,6 +76,7 @@ export declare const enum RuntimeErrorCode {
76
76
  SIGNAL_WRITE_FROM_ILLEGAL_CONTEXT = 600,
77
77
  REQUIRE_SYNC_WITHOUT_SYNC_EMIT = 601,
78
78
  ASSERTION_NOT_INSIDE_REACTIVE_CONTEXT = -602,
79
+ ANIMATE_INVALID_VALUE = 650,
79
80
  INVALID_I18N_STRUCTURE = 700,
80
81
  MISSING_LOCALE_DATA = 701,
81
82
  DEFER_LOADING_FAILED = -750,
@@ -91,6 +92,10 @@ export declare const enum RuntimeErrorCode {
91
92
  TYPE_IS_NOT_STANDALONE = 907,
92
93
  MISSING_ZONEJS = 908,
93
94
  UNEXPECTED_ZONE_STATE = 909,
95
+ UNSAFE_ATTRIBUTE_BINDING = -910,
96
+ /**
97
+ * @deprecated use `UNSAFE_ATTRIBUTE_BINDING` instead.
98
+ */
94
99
  UNSAFE_IFRAME_ATTRS = -910,
95
100
  VIEW_ALREADY_DESTROYED = 911,
96
101
  COMPONENT_ID_COLLISION = -912,
@@ -99,6 +104,7 @@ export declare const enum RuntimeErrorCode {
99
104
  MISSING_NG_MODULE_DEFINITION = 915,
100
105
  MISSING_DIRECTIVE_DEFINITION = 916,
101
106
  NO_COMPONENT_FACTORY_FOUND = 917,
107
+ EXTERNAL_RESOURCE_LOADING_FAILED = 918,
102
108
  REQUIRED_INPUT_NO_VALUE = -950,
103
109
  REQUIRED_QUERY_NO_VALUE = -951,
104
110
  REQUIRED_MODEL_NO_VALUE = 952,
package/import/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export * from './di/provider_token';
23
23
  export * from './error_handler';
24
24
  export * from './pending_tasks';
25
25
  export * from './linker/destroy_ref';
26
+ export { StaticProvider } from './di/interface/provider';
26
27
  export declare function Injectable(args?: any): (constructor: Function) => void;
27
28
  export declare class StaticInjectOptions {
28
29
  static injectOptions: Parameters<InjectableDecorator>[0];
@@ -11,6 +11,8 @@
11
11
  * is injected in a component or directive, the callbacks run when that component or
12
12
  * directive is destroyed. Otherwise the callbacks run when a corresponding injector is destroyed.
13
13
  *
14
+ * @see [Lifecycle DestroyRef](guide/components/lifecycle#destroyref)
15
+ *
14
16
  * @publicApi
15
17
  */
16
18
  export declare abstract class DestroyRef {
@@ -29,6 +31,16 @@ export declare abstract class DestroyRef {
29
31
  * // stop the destroy callback from executing if needed
30
32
  * unregisterFn();
31
33
  * ```
34
+ *
35
+ * @see [Lifecycle DestroyRef](guide/components/lifecycle#destroyref)
36
+ *
32
37
  */
33
38
  abstract onDestroy(callback: () => void): () => void;
39
+ /**
40
+ * Indicates whether the instance has already been destroyed.
41
+ *
42
+ * @see [Detecting instance destruction](guide/components/lifecycle#detecting-instance-destruction)
43
+ *
44
+ */
45
+ abstract get destroyed(): boolean;
34
46
  }
@@ -47,6 +47,9 @@ export declare class PendingTasksInternal implements OnDestroy {
47
47
  * taskCleanup();
48
48
  * ```
49
49
  *
50
+ *
51
+ * @see [PendingTasks for Server Side Rendering (SSR)](guide/zoneless#pendingtasks-for-server-side-rendering-ssr)
52
+ *
50
53
  * @publicApi 20.0
51
54
  */
52
55
  export declare class PendingTasks {
@@ -6,7 +6,17 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import type { ProviderToken } from '../di';
9
- /** Called when directives inject each other (creating a circular dependency) */
10
- export declare function throwCyclicDependencyError(token: string, path?: string[]): never;
9
+ /** Creates a circular dependency runtime error. */
10
+ export declare function cyclicDependencyError(token: string, path?: string[]): Error;
11
11
  /** Throws an error when a token is not found in DI. */
12
12
  export declare function throwProviderNotFoundError(token: ProviderToken<unknown>, injectorName?: string): never;
13
+ /**
14
+ * Creates an initial RuntimeError instance when a problem is detected.
15
+ * Monkey-patches extra info in the RuntimeError instance, so that it can
16
+ * be reused later, before throwing the final error.
17
+ */
18
+ export declare function createRuntimeError(message: string, code: number, path?: string[]): Error;
19
+ /**
20
+ * Reads monkey-patched error code from the given Error instance.
21
+ */
22
+ export declare function getRuntimeErrorCode(error: any): number | undefined;
@@ -27,5 +27,7 @@ export type Signal<T> = (() => T) & {
27
27
  export declare function isSignal(value: unknown): value is Signal<unknown>;
28
28
  /**
29
29
  * A comparison function which can determine if two values are equal.
30
+ *
31
+ * @publicApi 17.0
30
32
  */
31
33
  export type ValueEqualityFn<T> = (a: T, b: T) => boolean;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  /**
9
9
  * Asserts that the current stack frame is not within a reactive context. Useful
10
- * to disallow certain code from running inside a reactive context (see {@link /api/core/rxjs/toSignal toSignal})
10
+ * to disallow certain code from running inside a reactive context (see {@link /api/core/rxjs-interop/toSignal toSignal})
11
11
  *
12
12
  * @param debugFn a reference to the function making the assertion (used for the error message).
13
13
  *
@@ -21,5 +21,6 @@ export interface CreateComputedOptions<T> {
21
21
  }
22
22
  /**
23
23
  * Create a computed `Signal` which derives a reactive value from an expression.
24
+ * @see [Computed signals](guide/signals#computed-signals)
24
25
  */
25
26
  export declare function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T>;
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- import { ReactiveNode, SIGNAL } from '../../../primitives/signals';
8
+ import { SIGNAL, BaseEffectNode } from '../../../primitives/signals';
9
9
  import { Injector } from '../../di/injector';
10
10
  import { ChangeDetectionScheduler } from '../../change_detection/scheduling/zoneless_scheduling';
11
11
  import { EffectScheduler, SchedulableEffect } from './root_effect_scheduler';
@@ -62,12 +62,16 @@ export interface CreateEffectOptions {
62
62
  * before the next effect run. The cleanup function makes it possible to "cancel" any work that the
63
63
  * previous effect run might have started.
64
64
  *
65
+ * @see [Effect cleanup functions](guide/signals#effect-cleanup-functions)
66
+ *
65
67
  * @publicApi 20.0
66
68
  */
67
69
  export type EffectCleanupFn = () => void;
68
70
  /**
69
71
  * A callback passed to the effect function that makes it possible to register cleanup logic.
70
72
  *
73
+ * @see [Effect cleanup functions](guide/signals#effect-cleanup-functions)
74
+ *
71
75
  * @publicApi 20.0
72
76
  */
73
77
  export type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;
@@ -87,23 +91,20 @@ export type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;
87
91
  *
88
92
  * `effect()` must be run in injection context, unless the `injector` option is manually specified.
89
93
  *
94
+ * @see [Effects](guide/signals#effects)
95
+ *
90
96
  * @publicApi 20.0
91
97
  */
92
98
  export declare function effect(effectFn: (onCleanup: EffectCleanupRegisterFn) => void, options?: CreateEffectOptions): EffectRef;
93
- export interface EffectNode extends ReactiveNode, SchedulableEffect {
94
- hasRun: boolean;
99
+ export interface EffectNode extends BaseEffectNode, SchedulableEffect {
95
100
  cleanupFns: EffectCleanupFn[] | undefined;
96
101
  injector: Injector;
97
102
  notifier: ChangeDetectionScheduler;
98
103
  onDestroyFn: () => void;
99
- fn: (cleanupFn: EffectCleanupRegisterFn) => void;
100
- run(): void;
101
- destroy(): void;
102
- maybeCleanup(): void;
103
104
  }
104
105
  export interface RootEffectNode extends EffectNode {
105
106
  scheduler: EffectScheduler;
106
107
  }
107
- export declare const BASE_EFFECT_NODE: Omit<EffectNode, 'fn' | 'destroy' | 'injector' | 'notifier'>;
108
+ export declare const EFFECT_NODE: Omit<EffectNode, 'fn' | 'destroy' | 'injector' | 'notifier'>;
108
109
  export declare const ROOT_EFFECT_NODE: Omit<RootEffectNode, 'fn' | 'scheduler' | 'notifier' | 'injector'>;
109
110
  export declare function createRootEffect(fn: (onCleanup: EffectCleanupRegisterFn) => void, scheduler: EffectScheduler, notifier: ChangeDetectionScheduler): RootEffectNode;
@@ -14,6 +14,7 @@ import { WritableSignal } from './signal';
14
14
  */
15
15
  export declare function linkedSignal<D>(computation: () => D, options?: {
16
16
  equal?: ValueEqualityFn<NoInfer<D>>;
17
+ debugName?: string;
17
18
  }): WritableSignal<D>;
18
19
  /**
19
20
  * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.
@@ -22,6 +23,7 @@ export declare function linkedSignal<D>(computation: () => D, options?: {
22
23
  * Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.
23
24
  *
24
25
  * @publicApi 20.0
26
+ * @see [Dependent state with linkedSignal](guide/signals/linked-signal)
25
27
  */
26
28
  export declare function linkedSignal<S, D>(options: {
27
29
  source: () => S;
@@ -30,4 +32,5 @@ export declare function linkedSignal<S, D>(options: {
30
32
  value: NoInfer<D>;
31
33
  }) => D;
32
34
  equal?: ValueEqualityFn<NoInfer<D>>;
35
+ debugName?: string;
33
36
  }): WritableSignal<D>;
@@ -54,6 +54,7 @@ export interface CreateSignalOptions<T> {
54
54
  }
55
55
  /**
56
56
  * Create a `Signal` that can be set or updated directly.
57
+ * @see [Angular Signals](guide/signals)
57
58
  */
58
59
  export declare function signal<T>(initialValue: T, options?: CreateSignalOptions<T>): WritableSignal<T>;
59
60
  export declare function signalAsReadonlyFn<T>(this: SignalGetter<T>): Signal<T>;
@@ -8,5 +8,6 @@
8
8
  /**
9
9
  * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
10
10
  * can, optionally, return a value.
11
+ * @see [Reading without tracking dependencies](guide/signals#reading-without-tracking-dependencies)
11
12
  */
12
13
  export declare function untracked<T>(nonReactiveReadsFn: () => T): T;
@@ -64,7 +64,8 @@ export interface Resource<T> {
64
64
  *
65
65
  * This function is reactive.
66
66
  */
67
- hasValue(): this is Resource<Exclude<T, undefined>>;
67
+ hasValue(this: T extends undefined ? this : never): this is Resource<Exclude<T, undefined>>;
68
+ hasValue(): boolean;
68
69
  }
69
70
  /**
70
71
  * A `Resource` with a mutable value.
@@ -75,7 +76,8 @@ export interface Resource<T> {
75
76
  */
76
77
  export interface WritableResource<T> extends Resource<T> {
77
78
  readonly value: WritableSignal<T>;
78
- hasValue(): this is WritableResource<Exclude<T, undefined>>;
79
+ hasValue(this: T extends undefined ? this : never): this is WritableResource<Exclude<T, undefined>>;
80
+ hasValue(): boolean;
79
81
  /**
80
82
  * Convenience wrapper for `value.set`.
81
83
  */
@@ -101,7 +103,8 @@ export interface WritableResource<T> extends Resource<T> {
101
103
  * @experimental
102
104
  */
103
105
  export interface ResourceRef<T> extends WritableResource<T> {
104
- hasValue(): this is ResourceRef<Exclude<T, undefined>>;
106
+ hasValue(this: T extends undefined ? this : never): this is ResourceRef<Exclude<T, undefined>>;
107
+ hasValue(): boolean;
105
108
  /**
106
109
  * Manually destroy the resource, which cancels pending requests and returns it to `idle` state.
107
110
  */
@@ -142,7 +145,7 @@ export interface BaseResourceOptions<T, R> {
142
145
  * A reactive function which determines the request to be made. Whenever the request changes, the
143
146
  * loader will be triggered to fetch a new value for the resource.
144
147
  *
145
- * If a request function isn't provided, the loader won't rerun unless the resource is reloaded.
148
+ * If a params function isn't provided, the loader won't rerun unless the resource is reloaded.
146
149
  */
147
150
  params?: () => R;
148
151
  /**
@@ -6,9 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { WritableSignal } from '../render3/reactivity/signal';
9
- import { Signal } from '../render3/reactivity/api';
9
+ import { Signal, ValueEqualityFn } from '../render3/reactivity/api';
10
10
  import { ResourceOptions, ResourceStatus, WritableResource, Resource, ResourceRef, ResourceStreamingLoader } from './api';
11
- import { ValueEqualityFn } from '../../primitives/signals';
12
11
  import { Injector } from '../di/injector';
13
12
  /**
14
13
  * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by
@@ -18,6 +17,8 @@ import { Injector } from '../di/injector';
18
17
  * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new
19
18
  * request object becomes available, which could prematurely abort mutations.
20
19
  *
20
+ * @see [Async reactivity with resources](guide/signals/resource)
21
+ *
21
22
  * @experimental 19.0
22
23
  */
23
24
  export declare function resource<T, R>(options: ResourceOptions<T, R> & {
@@ -32,6 +33,7 @@ export declare function resource<T, R>(options: ResourceOptions<T, R> & {
32
33
  * request object becomes available, which could prematurely abort mutations.
33
34
  *
34
35
  * @experimental 19.0
36
+ * @see [Async reactivity with resources](guide/signals/resource)
35
37
  */
36
38
  export declare function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined>;
37
39
  type WrappedRequest = {
@@ -51,6 +53,7 @@ declare abstract class BaseWritableResource<T> implements WritableResource<T> {
51
53
  private readonly isError;
52
54
  update(updateFn: (value: T) => T): void;
53
55
  readonly isLoading: Signal<boolean>;
56
+ private readonly isValueDefined;
54
57
  hasValue(): this is ResourceRef<Exclude<T, undefined>>;
55
58
  asReadonly(): Resource<T>;
56
59
  }
@@ -75,7 +78,7 @@ export declare class ResourceImpl<T, R> extends BaseWritableResource<T> implemen
75
78
  private resolvePendingTask;
76
79
  private destroyed;
77
80
  private unregisterOnDestroy;
78
- constructor(request: () => R, loaderFn: ResourceStreamingLoader<T, R>, defaultValue: T, equal: ValueEqualityFn<T> | undefined, injector: Injector, throwErrorsFromValue?: boolean);
81
+ constructor(request: () => R, loaderFn: ResourceStreamingLoader<T, R>, defaultValue: T, equal: ValueEqualityFn<T> | undefined, injector: Injector);
79
82
  readonly status: Signal<ResourceStatus>;
80
83
  readonly error: Signal<Error | undefined>;
81
84
  /**