mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 06:50:19 +00:00
feat: add @rdfjs/sink-map (#41649)
This commit is contained in:
committed by
Eli Barzilay
parent
f40a27d7e3
commit
c537b15a91
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for @rdfjs/sink-map 1.0
|
||||
// Project: https://github.com/rdfjs-base/sink-map
|
||||
// Definitions by: tpluscode <https://github.com/tpluscode>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { Sink } from 'rdf-js';
|
||||
|
||||
declare namespace SinkMap {
|
||||
interface SinkMap<InputStream extends EventEmitter, OutputStream extends EventEmitter> extends Map<string, Sink<InputStream, OutputStream>> {
|
||||
import(mediaType: string, input: InputStream, options?: any): OutputStream | null;
|
||||
}
|
||||
}
|
||||
|
||||
declare class SinkMap<InputStream extends EventEmitter, OutputStream extends EventEmitter> extends Map<string, Sink<InputStream, OutputStream>> implements SinkMap<InputStream, OutputStream> {
|
||||
import(mediaType: string, input: InputStream, options?: any): OutputStream | null;
|
||||
}
|
||||
|
||||
export = SinkMap;
|
||||
@@ -0,0 +1,20 @@
|
||||
import SinkMap = require('@rdfjs/sink-map');
|
||||
import { Stream, Sink } from 'rdf-js';
|
||||
|
||||
const parsers: SinkMap<NodeJS.ReadableStream, Stream> = new SinkMap<NodeJS.ReadableStream, Stream>();
|
||||
|
||||
function createSinkMap(): SinkMap<NodeJS.ReadableStream, Stream> {
|
||||
const parser: Sink<NodeJS.ReadableStream, Stream> = <any> {};
|
||||
return new SinkMap<NodeJS.ReadableStream, Stream>([
|
||||
['text/turtle', parser]
|
||||
]);
|
||||
}
|
||||
|
||||
function castToMap(): Map<string, Sink<NodeJS.ReadableStream, Stream>> {
|
||||
return parsers;
|
||||
}
|
||||
|
||||
function importing(): Stream | null {
|
||||
const input: NodeJS.ReadableStream = <any> {};
|
||||
return parsers.import('text/turtle', input);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@rdfjs/sink-map": [
|
||||
"rdfjs__sink-map"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"rdfjs__sink-map-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user