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

enable verbatimModuleSyntax tsconfig option #12328

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion config/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $.cwd = join(import.meta.dirname, "..");
$.verbose = true;

const buildSteps = {
typescript: () => $`npx tsc`,
typescript: () => $`npx tsc --verbatimModuleSyntax false`,
updateVersion,
inlineInheritDoc,
processInvariants,
Expand Down
1 change: 1 addition & 0 deletions config/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const defaults = {
diagnostics: {
warnOnly: process.env.TEST_ENV !== "ci",
},
tsconfig: import.meta.dirname + "/../tsconfig.tests.json",
},
],
},
Expand Down
3 changes: 0 additions & 3 deletions src/__tests__/__snapshots__/exports.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Array [
"ApolloClient",
"ApolloError",
"ApolloLink",
"Cache",
"DocumentTransform",
"HttpLink",
"InMemoryCache",
Expand Down Expand Up @@ -53,7 +52,6 @@ Array [
exports[`exports of public entry points @apollo/client/cache 1`] = `
Array [
"ApolloCache",
"Cache",
"EntityStore",
"InMemoryCache",
"MissingFieldError",
Expand All @@ -75,7 +73,6 @@ Array [
"ApolloClient",
"ApolloError",
"ApolloLink",
"Cache",
"DocumentTransform",
"HttpLink",
"InMemoryCache",
Expand Down
29 changes: 20 additions & 9 deletions src/cache/core/types/Cache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataProxy } from "./DataProxy.js";
import type { DataProxy } from "./DataProxy.js";
import type { AllFieldsModifier, Modifiers } from "./common.js";
import type { ApolloCache } from "../cache.js";
import type { Unmasked } from "../../../masking/index.js";
Expand Down Expand Up @@ -105,12 +105,23 @@ export namespace Cache {
) => any;
}

export import DiffResult = DataProxy.DiffResult;
export import ReadQueryOptions = DataProxy.ReadQueryOptions;
export import ReadFragmentOptions = DataProxy.ReadFragmentOptions;
export import WriteQueryOptions = DataProxy.WriteQueryOptions;
export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;
export import UpdateQueryOptions = DataProxy.UpdateQueryOptions;
export import UpdateFragmentOptions = DataProxy.UpdateFragmentOptions;
export import Fragment = DataProxy.Fragment;
export type DiffResult<T> = DataProxy.DiffResult<T>;
export type ReadQueryOptions<TData, TVariables> = DataProxy.ReadQueryOptions<
TData,
TVariables
>;
export type ReadFragmentOptions<TData, TVariables> =
DataProxy.ReadFragmentOptions<TData, TVariables>;
export type WriteQueryOptions<TData, TVariables> =
DataProxy.WriteQueryOptions<TData, TVariables>;
export type WriteFragmentOptions<TData, TVariables> =
DataProxy.WriteFragmentOptions<TData, TVariables>;
export type UpdateQueryOptions<TData, TVariables> =
DataProxy.UpdateQueryOptions<TData, TVariables>;
export type UpdateFragmentOptions<TData, TVariables> =
DataProxy.UpdateFragmentOptions<TData, TVariables>;
export type Fragment<TVariables, TData> = DataProxy.Fragment<
TVariables,
TData
>;
}
2 changes: 1 addition & 1 deletion src/cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type {
WatchFragmentResult,
} from "./core/cache.js";
export { ApolloCache } from "./core/cache.js";
export { Cache } from "./core/types/Cache.js";
export type { Cache } from "./core/types/Cache.js";
export type { DataProxy } from "./core/types/DataProxy.js";
export type {
MissingTree,
Expand Down
2 changes: 1 addition & 1 deletion src/cache/inmemory/inMemoryCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ export class InMemoryCache extends ApolloCache<NormalizedCacheObject> {
* information to the DevTools.
* Use at your own risk!
*/
public getMemoryInternals?: typeof getInMemoryCacheMemoryInternals;
public declare getMemoryInternals?: typeof getInMemoryCacheMemoryInternals;
}

if (__DEV__) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type {
WatchFragmentResult,
} from "../cache/index.js";
export {
Cache,
type Cache,
ApolloCache,
InMemoryCache,
MissingFieldError,
Expand Down
2 changes: 1 addition & 1 deletion src/link/error/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export namespace ErrorLink {
}

// For backwards compatibility.
export import ErrorHandler = ErrorLink.ErrorHandler;
export type ErrorHandler = ErrorLink.ErrorHandler;

export function onError(errorHandler: ErrorHandler): ApolloLink {
return new ApolloLink((operation, forward) => {
Expand Down
2 changes: 1 addition & 1 deletion src/link/ws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export namespace WebSocketLink {
}

// For backwards compatibility.
export import WebSocketParams = WebSocketLink.Configuration;
export type WebSocketParams = WebSocketLink.Configuration;

export class WebSocketLink extends ApolloLink {
private subscriptionClient: SubscriptionClient;
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"outDir": "./dist",
"lib": ["es2015", "esnext.asynciterable"],
"jsx": "react",
"strict": true
"strict": true,
"verbatimModuleSyntax": true
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["src/**/__tests__/**/*"]
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.tests.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "./src/tsconfig.json"
"extends": "./src/tsconfig.json",
"compilerOptions": {
"verbatimModuleSyntax": false
}
}
Loading