Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: typed +server.ts responses with fetch #11108

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests
  • Loading branch information
AlbertMarashi committed Nov 23, 2023
commit 21b15e4a25c24ea1778f47d9a15c49d18bb9e608
18 changes: 9 additions & 9 deletions packages/kit/src/core/sync/write_types/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test('Rewrites types for a TypeScript module', () => {
};
`;

const rewritten = tweak_types(source, false);
const rewritten = tweak_types(source, 'page');

expect(rewritten?.exports).toEqual(['load']);
assert.equal(
Expand All @@ -83,7 +83,7 @@ test('Rewrites types for a TypeScript module without param', () => {
};
`;

const rewritten = tweak_types(source, false);
const rewritten = tweak_types(source, 'page');

expect(rewritten?.exports).toEqual(['load']);
assert.equal(
Expand All @@ -109,7 +109,7 @@ test('Rewrites types for a TypeScript module without param and jsdoc without typ
};
`;

const rewritten = tweak_types(source, false);
const rewritten = tweak_types(source, 'page');

expect(rewritten?.exports).toEqual(['load']);
assert.equal(
Expand All @@ -136,7 +136,7 @@ test('Rewrites types for a JavaScript module with `function`', () => {
};
`;

const rewritten = tweak_types(source, false);
const rewritten = tweak_types(source, 'page');

expect(rewritten?.exports).toEqual(['load']);
assert.equal(
Expand All @@ -163,7 +163,7 @@ test('Rewrites types for a JavaScript module with `const`', () => {
};
`;

const rewritten = tweak_types(source, false);
const rewritten = tweak_types(source, 'page');

expect(rewritten?.exports).toEqual(['load']);
assert.equal(
Expand All @@ -190,7 +190,7 @@ test('Appends @ts-nocheck after @ts-check', () => {
};
`;

const rewritten = tweak_types(source, false);
const rewritten = tweak_types(source, 'page');

expect(rewritten?.exports).toEqual(['load']);
assert.equal(
Expand Down Expand Up @@ -219,7 +219,7 @@ test('Rewrites action types for a JavaScript module', () => {
}
`;

const rewritten = tweak_types(source, true);
const rewritten = tweak_types(source, 'page.server');

expect(rewritten?.exports).toEqual(['actions']);
assert.equal(
Expand Down Expand Up @@ -248,7 +248,7 @@ test('Rewrites action types for a TypeScript module', () => {
}
`;

const rewritten = tweak_types(source, true);
const rewritten = tweak_types(source, 'page.server');

expect(rewritten?.exports).toEqual(['actions']);
assert.equal(
Expand Down Expand Up @@ -281,7 +281,7 @@ test('Leaves satisfies operator untouched', () => {
} satisfies Actions
`;

const rewritten = tweak_types(source, true);
const rewritten = tweak_types(source, 'page.server');

expect(rewritten?.exports).toEqual(['load', 'actions']);
assert.equal(rewritten?.modified, false);
Expand Down
Loading