use native DOM types for text-encoding module

This commit is contained in:
Mohsen Azimi
2018-05-30 04:59:45 -07:00
parent 86fa899b1f
commit 207749d1fa
2 changed files with 8 additions and 66 deletions

View File

@@ -1,60 +1,9 @@
// Type definitions for text-encoding
// Project: https://github.com/inexorabletash/text-encoding
// Definitions by: MIZUNE Pine <https://github.com/pine613>
// Mohsen Azimi <https://github.com/mohsen1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
declare namespace TextEncoding {
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
interface TextDecodeOptions {
stream?: boolean;
}
interface TextEncoderOptions {
NONSTANDARD_allowLegacyEncoding?: boolean;
}
interface TextDecoder {
encoding: string;
fatal: boolean;
ignoreBOM: boolean;
decode(input?: ArrayBuffer | ArrayBufferView, options?: TextDecodeOptions): string;
}
interface TextEncoder {
encoding: string;
encode(input?: string, options?: TextEncodeOptions): Uint8Array;
}
interface TextEncodeOptions {
stream?: boolean;
}
interface TextEncoderStatic {
(utfLabel?: string, options?: TextEncoderOptions): TextEncoder;
new (utfLabel?: string, options?: TextEncoderOptions): TextEncoder;
}
interface TextDecoderStatic {
(label?: string, options?: TextDecoderOptions): TextDecoder;
new (label?: string, options?: TextDecoderOptions): TextDecoder;
}
interface TextEncodingStatic {
TextEncoder: TextEncoderStatic;
TextDecoder: TextDecoderStatic;
}
}
declare var TextDecoder: TextEncoding.TextDecoderStatic;
declare var TextEncoder: TextEncoding.TextEncoderStatic;
declare var TextEncoding: TextEncoding.TextEncodingStatic;
declare module "text-encoding" {
export = TextEncoding;
}
export const TextEncoder: TextEncoder;
export const TextDecoder: TextDecoder;

View File

@@ -1,23 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"lib": ["dom", "es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"text-encoding-tests.ts"
]
}
"files": ["index.d.ts", "text-encoding-tests.ts"]
}