Skip to content

Commit 9c3d1b1

Browse files
cursoragentntucker
andcommitted
fix(rest): fix type test errors for content+schema guard and missing expect
- Make arrayBuffer and stream @ts-expect-error tests single-line so the directive covers the entire statement (multi-line caused the error to land on individual properties, making the directive appear unused) - Replace runtime expect() with satisfies check in type-only test file (expect is not available in the typescript-tests tsconfig) Co-authored-by: Nathaniel Tucker <me@ntucker.me>
1 parent c561f3e commit 9c3d1b1

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

‎packages/rest/typescript-tests/types.test.ts‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,18 +2054,10 @@ it('content property: schema constraint', () => {
20542054
new RestEndpoint({ path: '/x' as const, content: 'text', schema: Article });
20552055

20562056
// @ts-expect-error - schema incompatible with content: 'arrayBuffer'
2057-
new RestEndpoint({
2058-
path: '/x' as const,
2059-
content: 'arrayBuffer',
2060-
schema: Article,
2061-
});
2057+
new RestEndpoint({ path: '/x' as const, content: 'arrayBuffer', schema: Article });
20622058

20632059
// @ts-expect-error - schema incompatible with content: 'stream'
2064-
new RestEndpoint({
2065-
path: '/x' as const,
2066-
content: 'stream',
2067-
schema: Article,
2068-
});
2060+
new RestEndpoint({ path: '/x' as const, content: 'stream', schema: Article });
20692061

20702062
// content: 'json' allows schema
20712063
new RestEndpoint({
@@ -2153,5 +2145,11 @@ it('content property: extend and subclass', () => {
21532145
const subclassed = new BlobEndpoint({
21542146
path: '/files/:id' as const,
21552147
});
2156-
expect(subclassed.content).toBe('blob');
2148+
subclassed.content satisfies
2149+
| 'blob'
2150+
| 'json'
2151+
| 'text'
2152+
| 'arrayBuffer'
2153+
| 'stream'
2154+
| undefined;
21572155
});

0 commit comments

Comments
 (0)