Skip to content

Commit

Permalink
Merge pull request #1481 from glimmerjs/make-createPrimitiveRef-generic
Browse files Browse the repository at this point in the history
MakePrimitiveRef generic so that UNDEFINED_REFERENCE can be Reference<undefined> rather than Reference<unknown>
  • Loading branch information
NullVoxPopuli authored Nov 1, 2023
2 parents 0040a17 + e213cc1 commit 3f6f3fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/@glimmer/reference/lib/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class ReferenceImpl<T = unknown> implements Reference<T> {
}
}

export function createPrimitiveRef(value: unknown): Reference {
const ref = new ReferenceImpl(UNBOUND);
export function createPrimitiveRef<T = unknown>(value: T): Reference<T> {
const ref = new ReferenceImpl<T>(UNBOUND);

ref.tag = CONSTANT_TAG;
ref.lastValue = value;
Expand All @@ -71,8 +71,8 @@ export function createPrimitiveRef(value: unknown): Reference {

export const UNDEFINED_REFERENCE = createPrimitiveRef(undefined);
export const NULL_REFERENCE = createPrimitiveRef(null);
export const TRUE_REFERENCE = createPrimitiveRef(true);
export const FALSE_REFERENCE = createPrimitiveRef(false);
export const TRUE_REFERENCE = createPrimitiveRef(true as const);
export const FALSE_REFERENCE = createPrimitiveRef(false as const);

export function createConstRef(value: unknown, debugLabel: false | string): Reference {
const ref = new ReferenceImpl(CONSTANT);
Expand Down

0 comments on commit 3f6f3fe

Please sign in to comment.