Skip to content

Commit

Permalink
Properly reference imports for module type (#217)
Browse files Browse the repository at this point in the history
Due to changes made in #180, exports were referenced as `.js` files,
which means that all files must subsequently imported with the `.js`
full extension because we are declared as `type: module`.

The javascript module system just keeps on giving.

Fixes #216
  • Loading branch information
paul-sachs committed Oct 12, 2023
1 parent 86bfd75 commit 9736287
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions packages/connect-query/src/connect-query-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import type {
ServiceType,
} from "@bufbuild/protobuf";

import type { DisableQuery } from "./utils";
import { disableQuery } from "./utils";
import type { DisableQuery } from "./utils.js";
import { disableQuery } from "./utils.js";

/**
* TanStack Query requires query keys in order to decide when the query should automatically update.
Expand Down
6 changes: 3 additions & 3 deletions packages/connect-query/src/create-query-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import type {
import { MethodKind } from "@bufbuild/protobuf";
import type { Transport } from "@connectrpc/connect";

import type { UnaryFunctions } from "./create-unary-functions";
import { createUnaryFunctions } from "./create-unary-functions";
import { unreachableCase } from "./utils";
import type { UnaryFunctions } from "./create-unary-functions.js";
import { createUnaryFunctions } from "./create-unary-functions.js";
import { unreachableCase } from "./utils.js";

/**
* This is an array of supported `MethodKind`s
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-query/src/create-query-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import type { ServiceType } from "@bufbuild/protobuf";
import type { Transport } from "@connectrpc/connect";

import type { QueryFunctions } from "./create-query-functions";
import { createQueryFunctions } from "./create-query-functions";
import type { QueryFunctions } from "./create-query-functions.js";
import { createQueryFunctions } from "./create-query-functions.js";

const servicesToHooks = new Map<ServiceType, QueryFunctions<ServiceType>>();

Expand Down
8 changes: 4 additions & 4 deletions packages/connect-query/src/create-unary-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ import type {
import type {
ConnectPartialQueryKey,
ConnectQueryKey,
} from "./connect-query-key";
import { makeConnectQueryKeyGetter } from "./connect-query-key";
import type { DisableQuery } from "./utils";
} from "./connect-query-key.js";
import { makeConnectQueryKeyGetter } from "./connect-query-key.js";
import type { DisableQuery } from "./utils.js";
import {
assert,
disableQuery,
isUnaryMethod,
protobufSafeUpdater,
unreachableCase,
} from "./utils";
} from "./utils.js";

type RequireExactlyOne<T, Keys extends keyof T = keyof T> = {
[K in Keys]-?: Partial<Record<Exclude<Keys, K>, undefined>> &
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-query/src/create-unary-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import type { Message } from "@bufbuild/protobuf";

import type { UnaryFunctions } from "./create-unary-functions";
import { useTransport } from "./use-transport";
import type { UnaryFunctions } from "./create-unary-functions.js";
import { useTransport } from "./use-transport.js";

/**
* All the additional hooks that are unique to React.
Expand Down
24 changes: 12 additions & 12 deletions packages/connect-query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@

import type { Message } from "@bufbuild/protobuf";

import type { UnaryFunctions } from "./create-unary-functions";
import type { UnaryHooks } from "./create-unary-hooks";
import type { UnaryFunctions } from "./create-unary-functions.js";
import type { UnaryHooks } from "./create-unary-hooks.js";

export { createQueryService } from "./create-query-service";
export { createQueryService } from "./create-query-service.js";
export type {
QueryFunctions,
SupportedMethodInfo,
IsSupportedMethod,
SupportedMethodKinds,
} from "./create-query-functions";
} from "./create-query-functions.js";
export {
createQueryFunctions,
supportedMethodKinds,
isSupportedMethod,
} from "./create-query-functions";
} from "./create-query-functions.js";
export type {
ConnectQueryKey,
ConnectPartialQueryKey,
} from "./connect-query-key";
export type { UnaryFunctions } from "./create-unary-functions";
export { createUnaryFunctions } from "./create-unary-functions";
export { disableQuery } from "./utils";
export { useTransport, TransportProvider } from "./use-transport";
export type { UnaryHooks } from "./create-unary-hooks";
export { createUnaryHooks } from "./create-unary-hooks";
} from "./connect-query-key.js";
export type { UnaryFunctions } from "./create-unary-functions.js";
export { createUnaryFunctions } from "./create-unary-functions.js";
export { disableQuery } from "./utils.js";
export { useTransport, TransportProvider } from "./use-transport.js";
export type { UnaryHooks } from "./create-unary-hooks.js";
export { createUnaryHooks } from "./create-unary-hooks.js";

/**
* Combined type of all the functions generated for a service.
Expand Down

0 comments on commit 9736287

Please sign in to comment.