Skip to content

Commit 703dcb4

Browse files
committed
Fix types in test
1 parent ea88c26 commit 703dcb4

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.changeset/seven-seahorses-cry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"@preact/signals-core": patch
2+
"@preact/signals-core": minor
33
---
44

55
Adjust ReadOnlySignal to not inherit from `Signal`

packages/core/test/signal.test.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
batch,
66
Signal,
77
untracked,
8+
ReadonlySignal,
89
} from "@preact/signals-core";
910

1011
describe("signal", () => {
@@ -962,15 +963,15 @@ describe("computed()", () => {
962963
});
963964

964965
it("should detect simple dependency cycles", () => {
965-
const a: Signal = computed(() => a.value);
966+
const a: ReadonlySignal = computed(() => a.value);
966967
expect(() => a.value).to.throw(/Cycle detected/);
967968
});
968969

969970
it("should detect deep dependency cycles", () => {
970-
const a: Signal = computed(() => b.value);
971-
const b: Signal = computed(() => c.value);
972-
const c: Signal = computed(() => d.value);
973-
const d: Signal = computed(() => a.value);
971+
const a: ReadonlySignal = computed(() => b.value);
972+
const b: ReadonlySignal = computed(() => c.value);
973+
const c: ReadonlySignal = computed(() => d.value);
974+
const d: ReadonlySignal = computed(() => a.value);
974975
expect(() => a.value).to.throw(/Cycle detected/);
975976
});
976977

@@ -1243,15 +1244,15 @@ describe("computed()", () => {
12431244
});
12441245

12451246
it("should detect simple dependency cycles", () => {
1246-
const a: Signal = computed(() => a.peek());
1247+
const a: ReadonlySignal = computed(() => a.peek());
12471248
expect(() => a.peek()).to.throw(/Cycle detected/);
12481249
});
12491250

12501251
it("should detect deep dependency cycles", () => {
1251-
const a: Signal = computed(() => b.value);
1252-
const b: Signal = computed(() => c.value);
1253-
const c: Signal = computed(() => d.value);
1254-
const d: Signal = computed(() => a.peek());
1252+
const a: ReadonlySignal = computed(() => b.value);
1253+
const b: ReadonlySignal = computed(() => c.value);
1254+
const c: ReadonlySignal = computed(() => d.value);
1255+
const d: ReadonlySignal = computed(() => a.peek());
12551256
expect(() => a.peek()).to.throw(/Cycle detected/);
12561257
});
12571258

@@ -1340,7 +1341,7 @@ describe("computed()", () => {
13401341
it("should be garbage collectable after it has lost all of its listeners", async () => {
13411342
const s = signal(0);
13421343

1343-
let ref: WeakRef<Signal>;
1344+
let ref: WeakRef<ReadonlySignal>;
13441345
let dispose: () => void;
13451346
(function () {
13461347
const c = computed(() => s.value);

0 commit comments

Comments
 (0)