Skip to content

Commit 75b5486

Browse files
refactor: use .ts extension for relative file imports (#92)
1 parent 905b985 commit 75b5486

24 files changed

+36
-35
lines changed

exports/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
export type { AnyApiSpec, HttpMethod } from "../src/api-spec.js";
1+
export type { AnyApiSpec, HttpMethod } from "../src/api-spec.ts";
22

33
export {
44
createOpenApiHttp,
55
type HttpOptions,
66
type OpenApiHttpHandlers,
77
type OpenApiHttpRequestHandler,
8-
} from "../src/openapi-http.js";
8+
} from "../src/openapi-http.ts";
99

1010
export type {
1111
ResponseResolver,
1212
ResponseResolverInfo,
13-
} from "../src/response-resolver.js";
13+
} from "../src/response-resolver.ts";
1414

1515
export type {
1616
AnyOpenApiHttpRequestHandler,
1717
PathsFor,
1818
RequestBodyFor,
1919
ResponseBodyFor,
20-
} from "../src/openapi-http-utilities.js";
20+
} from "../src/openapi-http-utilities.ts";

src/api-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type {
22
ConvertToStringified,
33
MapToValues,
44
ResolvedObjectUnion,
5-
} from "./type-utils.js";
5+
} from "./type-utils.ts";
66

77
/** Base type that any api spec should extend. */
88
export type AnyApiSpec = NonNullable<unknown>;

src/openapi-http-utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type {
44
PathsForMethod,
55
RequestBody,
66
ResponseBody,
7-
} from "./api-spec.js";
8-
import type { OpenApiHttpRequestHandler } from "./openapi-http.js";
7+
} from "./api-spec.ts";
8+
import type { OpenApiHttpRequestHandler } from "./openapi-http.ts";
99

1010
/**
1111
* Base type that generic {@link OpenApiHttpRequestHandler | OpenApiHttpRequestHandlers}

src/openapi-http.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import { http as mswHttp } from "msw";
33
import { describe, expect, it, vi } from "vitest";
4-
import type { HttpMethod } from "./api-spec.js";
5-
import { createOpenApiHttp } from "./openapi-http.js";
4+
import type { HttpMethod } from "./api-spec.ts";
5+
import { createOpenApiHttp } from "./openapi-http.ts";
66

77
const methods: HttpMethod[] = [
88
"get",

src/openapi-http.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { http, type HttpHandler, type RequestHandlerOptions } from "msw";
2-
import type { AnyApiSpec, HttpMethod, PathsForMethod } from "./api-spec.js";
3-
import { convertToColonPath } from "./path-mapping.js";
2+
import type { AnyApiSpec, HttpMethod, PathsForMethod } from "./api-spec.ts";
3+
import { convertToColonPath } from "./path-mapping.ts";
44
import {
55
createResolverWrapper,
66
type ResponseResolver,
7-
} from "./response-resolver.js";
7+
} from "./response-resolver.ts";
88

99
/** HTTP handler factory with type inference for provided api paths. */
1010
export type OpenApiHttpRequestHandler<

src/path-mapping.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { convertToColonPath } from "./path-mapping.js";
2+
import { convertToColonPath } from "./path-mapping.ts";
33

44
describe(convertToColonPath, () => {
55
it("should leave paths with no path fragments untouched", () => {

src/query-params.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { OptionalKeys } from "./type-utils.js";
1+
import type { OptionalKeys } from "./type-utils.ts";
22

33
/** Return values for getting the first value of a query param. */
44
type ParamValuesGet<Params extends object> = {

src/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { JSONLike, TextLike } from "./type-utils.js";
1+
import type { JSONLike, TextLike } from "./type-utils.ts";
22

33
/** A type-safe request helper that enhances native body methods based on the given OpenAPI spec. */
44
export interface OpenApiRequest<RequestMap> extends Request {

src/response-resolver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import type {
1111
RequestMap,
1212
ResponseBody,
1313
ResponseMap,
14-
} from "./api-spec.js";
15-
import { QueryParams as QueryParamsUtil } from "./query-params.js";
16-
import type { OpenApiRequest } from "./request.js";
17-
import { createResponseHelper, type OpenApiResponse } from "./response.js";
14+
} from "./api-spec.ts";
15+
import { QueryParams as QueryParamsUtil } from "./query-params.ts";
16+
import type { OpenApiRequest } from "./request.ts";
17+
import { createResponseHelper, type OpenApiResponse } from "./response.ts";
1818

1919
/** Response resolver that gets provided to HTTP handler factories. */
2020
export type ResponseResolver<

src/response.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
type HttpResponseInit,
55
type StrictResponse,
66
} from "msw";
7-
import type { Wildcard } from "./http-status-wildcard.js";
8-
import type { JSONLike, NoContent, TextLike } from "./type-utils.js";
7+
import type { Wildcard } from "./http-status-wildcard.ts";
8+
import type { JSONLike, NoContent, TextLike } from "./type-utils.ts";
99

1010
/**
1111
* Requires or removes the status code from {@linkcode HttpResponseInit} depending

0 commit comments

Comments
 (0)