mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
🤖 Merge PR #45070 update(base64-js): v1.3 and UMD support by @peterblazejewicz
- update to v1.3 (no external API change) - correct module definition to support direct use in browsers as package is exported as UMD - tests updated - maintainer added https://unpkg.com/base64-js@1.3.1/base64js.min.js https://github.com/beatgammit/base64-js#base64-js Thanks!
This commit is contained in:
parent
049a947d56
commit
ee2ea4e569
17
types/base64-js/index.d.ts
vendored
17
types/base64-js/index.d.ts
vendored
@ -1,8 +1,23 @@
|
||||
// Type definitions for base64-js 1.2
|
||||
// Type definitions for base64-js 1.3
|
||||
// Project: https://github.com/beatgammit/base64-js
|
||||
// Definitions by: Peter Safranek <https://github.com/pe8ter>
|
||||
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Takes a base64 string and returns length of byte array
|
||||
*/
|
||||
export function byteLength(encoded: string): number;
|
||||
/**
|
||||
* Takes a base64 string and returns a byte array
|
||||
*/
|
||||
export function toByteArray(encoded: string): Uint8Array;
|
||||
/**
|
||||
* Takes a byte array and returns a base64 string
|
||||
*/
|
||||
export function fromByteArray(bytes: Uint8Array): string;
|
||||
|
||||
/**
|
||||
* base64-js does basic base64 encoding/decoding in pure JS.
|
||||
*/
|
||||
export as namespace base64js;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import * as base64js from "base64-js";
|
||||
import base64js = require("base64-js");
|
||||
|
||||
base64js.byteLength(""); // $ExpectType number
|
||||
base64js.toByteArray(""); // $ExpectType Uint8Array
|
||||
3
types/base64-js/test/base64-js-tests.global.ts
Normal file
3
types/base64-js/test/base64-js-tests.global.ts
Normal file
@ -0,0 +1,3 @@
|
||||
base64js.byteLength(''); // $ExpectType number
|
||||
base64js.toByteArray(''); // $ExpectType Uint8Array
|
||||
base64js.fromByteArray(new Uint8Array(0)); // $ExpectType string
|
||||
@ -18,6 +18,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"base64-js-tests.ts"
|
||||
"test/base64-js-tests.cjs.ts",
|
||||
"test/base64-js-tests.global.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user