Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 10 additions & 4 deletions packages/plugins/tanstack-query/tests/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ model Foo {
useInfiniteFindManypost_Item({ where: { published: true } });
useInfiniteFindManypost_Item(undefined, { enabled: true, getNextPageParam: () => null });
console.log(queryKey);
console.log(data?.pages[0][0].published);
console.log(data?.pages[0]?.[0]?.published);
console.log(data?.pageParams[0]);
}

Expand Down Expand Up @@ -97,6 +97,7 @@ ${sharedModel}
copyDependencies: [path.resolve(__dirname, '../dist')],
compile: true,
extraSourceFiles: [reactAppSource],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand Down Expand Up @@ -130,12 +131,13 @@ ${sharedModel}
useSuspenseInfiniteFindManypost_Item({ where: { published: true } });
useSuspenseInfiniteFindManypost_Item(undefined, { getNextPageParam: () => null });
console.log(queryKey);
console.log(data?.pages[0][0].published);
console.log(data?.pages[0]?.[0]?.published);
console.log(data?.pageParams[0]);
}
`,
},
],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand All @@ -157,7 +159,7 @@ ${sharedModel}
useInfiniteFindManypost_Item({ where: { published: true } }, { enabled: true, getNextPageParam: () => null });
useInfiniteFindManypost_Item(undefined, { getNextPageParam: () => null });
console.log(queryKey);
console.log(data.value?.pages[0][0].published);
console.log(data.value?.pages[0]?.[0]?.published);
console.log(data.value?.pageParams[0]);
}

Expand Down Expand Up @@ -189,6 +191,7 @@ ${sharedModel}
copyDependencies: [path.resolve(__dirname, '../dist')],
compile: true,
extraSourceFiles: [vueAppSource],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand All @@ -211,6 +214,7 @@ ${sharedModel}
copyDependencies: [path.resolve(__dirname, '../dist')],
compile: true,
extraSourceFiles: [vueAppSource],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand All @@ -233,7 +237,7 @@ ${sharedModel}
useInfiniteFindManypost_Item({ where: { published: true } });
useInfiniteFindManypost_Item(undefined, { enabled: true, getNextPageParam: () => null });
console.log(queryKey);
console.log(data?.pages[0][0].published);
console.log(data?.pages[0]?.[0]?.published);
console.log(data?.pageParams[0]);
}

Expand Down Expand Up @@ -265,6 +269,7 @@ ${sharedModel}
copyDependencies: [path.resolve(__dirname, '../dist')],
compile: true,
extraSourceFiles: [svelteAppSource],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand All @@ -287,6 +292,7 @@ ${sharedModel}
copyDependencies: [path.resolve(__dirname, '../dist')],
compile: true,
extraSourceFiles: [svelteAppSource],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand Down
7 changes: 5 additions & 2 deletions packages/plugins/tanstack-query/tests/portable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ describe('Tanstack Query Plugin Portable Tests', () => {
import { useFindUniqueUser } from './hooks';
const { data } = useFindUniqueUser({ where: { id: 1 }, include: { posts: true } });
console.log(data?.email);
console.log(data?.posts[0].title);
console.log(data?.posts[0]?.title);
`,
},
],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand Down Expand Up @@ -101,10 +102,11 @@ console.log(data?.posts[0].title);
import { useFindUniqueUser } from './hooks';
const { data } = useFindUniqueUser({ where: { id: 1 }, include: { posts: true } });
console.log(data?.email);
console.log(data?.posts[0].title);
console.log(data?.posts[0]?.title);
`,
},
],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand Down Expand Up @@ -147,6 +149,7 @@ console.log(data?.createdAt);
`,
},
],
tscInitArgs: '--moduleResolution bundler --module esnext',
}
);
});
Expand Down
3 changes: 2 additions & 1 deletion packages/testtools/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
prismaLoadPath?: string;
prismaClientOptions?: object;
generateNoCompile?: boolean;
tscInitArgs?: string;
};

const defaultOptions: SchemaLoadOptions = {
Expand Down Expand Up @@ -363,7 +364,7 @@
if (opt.compile || opt.extraSourceFiles) {
console.log('Compiling...');

run('npx tsc --init');
run(`npx tsc --init ${opt.tscInitArgs}`);

// add generated '.zenstack/zod' folder to typescript's search path,
// so that it can be resolved from symbolic-linked files
Expand Down
Loading