mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
fix(rdf-fetch): options are optional (#43294)
* feix(rdf-fetch): options are optional * options are also optional
This commit is contained in:
parent
0e3a2e2cf8
commit
cf0edd580e
4
types/rdfjs__fetch/index.d.ts
vendored
4
types/rdfjs__fetch/index.d.ts
vendored
@ -6,9 +6,9 @@
|
||||
import { FormatsInit, RdfFetchResponse, FactoryInit, DatasetResponse } from '@rdfjs/fetch-lite';
|
||||
import { DatasetCore, Quad, BaseQuad } from 'rdf-js';
|
||||
|
||||
declare function rdfFetch(url: string, options: FormatsInit): Promise<RdfFetchResponse>;
|
||||
declare function rdfFetch(url: string, options?: Partial<FormatsInit>): Promise<RdfFetchResponse>;
|
||||
declare function rdfFetch <D extends DatasetCore<OutQuad, InQuad>, OutQuad extends BaseQuad = Quad, InQuad extends BaseQuad = OutQuad>(
|
||||
url: string,
|
||||
options: FactoryInit<D, OutQuad, InQuad>): Promise<DatasetResponse<D, OutQuad, InQuad>>;
|
||||
options?: Partial<FactoryInit<D, OutQuad, InQuad>>): Promise<DatasetResponse<D, OutQuad, InQuad>>;
|
||||
|
||||
export = rdfFetch;
|
||||
|
||||
@ -2,11 +2,20 @@ import fetch = require('@rdfjs/fetch');
|
||||
import { SinkMap } from '@rdfjs/sink-map';
|
||||
import { Stream, Dataset, Quad, DatasetCoreFactory } from 'rdf-js';
|
||||
import { EventEmitter } from 'events';
|
||||
import { RdfFetchResponse } from '@rdfjs/fetch-lite';
|
||||
|
||||
const formats: {
|
||||
parsers: SinkMap<EventEmitter, Stream>;
|
||||
} = <any> {};
|
||||
|
||||
function noOptions(): Promise<RdfFetchResponse> {
|
||||
return fetch('http://example.com/');
|
||||
}
|
||||
|
||||
function allOptionsOptional(): Promise<RdfFetchResponse> {
|
||||
return fetch('http://example.com/', {});
|
||||
}
|
||||
|
||||
async function fetchString(): Promise<string> {
|
||||
const response = await fetch('http://example.com', { formats });
|
||||
return response.text();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user