Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use ts-graft to include requisite types from dom lib
- Loading branch information
Showing
5 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.log | ||
test.ponyfill.js | ||
test.polyfill.js | ||
dom.d.ts | ||
|
||
# OSX | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
grafts: [ | ||
{ | ||
source: "typescript/lib/lib.dom.d.ts", | ||
output: "dom.d.ts", | ||
include: ["RequestInit", "RequestInfo", "Response"], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
/// <reference lib="dom" /> | ||
import { | ||
Request, | ||
Response, | ||
Headers, | ||
RequestInfo, | ||
RequestInit | ||
} from "./dom" | ||
|
||
declare const _fetch: typeof fetch; | ||
declare const _Request: typeof Request; | ||
declare const _Response: typeof Response; | ||
declare const _Headers: typeof Headers; | ||
|
||
declare module "cross-fetch" { | ||
export const fetch: typeof _fetch; | ||
export const Request: typeof _Request; | ||
export const Response: typeof _Response; | ||
export const Headers: typeof _Headers; | ||
export const fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>; | ||
export const Request: { | ||
prototype: Request; | ||
new(input: RequestInfo, init?: RequestInit): Request; | ||
}; | ||
export const Response: { | ||
prototype: Response; | ||
new(body?: BodyInit | null, init?: ResponseInit): Response; | ||
error(): Response; | ||
redirect(url: string, status?: number): Response; | ||
}; | ||
export const Headers: { | ||
prototype: Headers; | ||
new(init?: HeadersInit): Headers; | ||
}; | ||
export default fetch; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters