Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7634cdc

Browse files
committed
refactor(types): deduplicate RequestInitExtended into src/types.ts
* Removed duplicate definitions from `src/hydra/types.ts` and deleted `src/openapi3/types.ts`. * Added a single canonical `RequestInitExtended` interface in `src/types.ts`. * Updated all affected import paths across Hydra and OpenAPI3 modules. Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
1 parent 0b6211b commit 7634cdc

File tree

8 files changed

+11
-13
lines changed

8 files changed

+11
-13
lines changed

‎src/hydra/fetchJsonLd.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Document, JsonLd, RemoteDocument } from "jsonld/jsonld-spec.js";
2-
import type { RequestInitExtended } from "./types.js";
2+
import type { RequestInitExtended } from "../types.js";
33

44
const jsonLdMimeType = "application/ld+json";
55
const jsonProblemMimeType = "application/problem+json";

‎src/hydra/fetchResource.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fetchJsonLd from "./fetchJsonLd.js";
2-
import type { IriTemplateMapping, RequestInitExtended } from "./types.js";
2+
import type { IriTemplateMapping } from "./types.js";
3+
import type { RequestInitExtended } from "../types.js";
34

45
export default async function fetchResource(
56
resourceUrl: string,

‎src/hydra/getParameters.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Parameter } from "../Parameter.js";
22
import fetchResource from "./fetchResource.js";
33
import type { Resource } from "../Resource.js";
4-
import type { RequestInitExtended } from "./types.js";
4+
import type { RequestInitExtended } from "../types.js";
55

66
export default async function getParameters(
77
resource: Resource,

‎src/hydra/parseHydraDocumentation.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import type {
1414
Entrypoint,
1515
ExpandedOperation,
1616
ExpandedRdfProperty,
17-
RequestInitExtended,
18-
} from "./types.js";
17+
}from"./types.js";
18+
importtype{RequestInitExtended} from "../types.js";
1919

2020
/**
2121
* Extracts the short name of a resource.

‎src/hydra/types.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
export interface RequestInitExtended extends Omit<RequestInit, "headers"> {
2-
headers?: HeadersInit | (() => HeadersInit);
3-
}
4-
51
export interface IriTemplateMapping {
62
"@type": "IriTemplateMapping";
73
variable: "string";

‎src/openapi3/parseOpenApi3Documentation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Api } from "../Api.js";
33
import handleJson, { removeTrailingSlash } from "./handleJson.js";
44
import type { OpenAPIV3 } from "openapi-types";
5-
import type { RequestInitExtended } from "./types.js";
5+
import type { RequestInitExtended } from "../types.js";
66

77
export interface ParsedOpenApi3Documentation {
88
api: Api;

‎src/openapi3/types.ts‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎src/types.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
export type Nullable<T extends Record<string, unknown>> = {
22
[P in keyof T]: T[P] | null;
33
};
4+
5+
export interface RequestInitExtended extends Omit<RequestInit, "headers"> {
6+
headers?: HeadersInit | (() => HeadersInit);
7+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /