mirror of
https://github.com/fluencelabs/js-mafmt
synced 2025-04-24 15:22:24 +00:00
feat: add typescript types + type tests (#48)
* feat: add typescript types * feat: add typescript type tests * chore: bump deps Co-authored-by: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
parent
52d9dfc062
commit
74830fa5d9
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,6 +27,7 @@ coverage
|
||||
.lock-wscript
|
||||
|
||||
build
|
||||
docs
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
|
@ -10,6 +10,7 @@
|
||||
"test": "aegir test",
|
||||
"test:node": "aegir test --target node",
|
||||
"test:browser": "aegir test --target browser",
|
||||
"test:types": "npx tsc",
|
||||
"release": "aegir release",
|
||||
"release-minor": "aegir release --type minor",
|
||||
"release-major": "aegir release --type major",
|
||||
@ -27,11 +28,13 @@
|
||||
"bugs": "https://github.com/multiformats/js-mafmt/issues",
|
||||
"homepage": "https://github.com/multiformats/js-mafmt#readme",
|
||||
"devDependencies": {
|
||||
"aegir": "^20.0.0",
|
||||
"@types/chai": "^4.2.8",
|
||||
"@types/mocha": "^7.0.1",
|
||||
"aegir": "^20.6.0",
|
||||
"chai": "^4.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"multiaddr": "^7.0.0"
|
||||
"multiaddr": "^7.3.0"
|
||||
},
|
||||
"contributors": [
|
||||
"Alan Shaw <alan@tableflip.io>",
|
||||
|
28
src/index.d.ts
vendored
Normal file
28
src/index.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
import Multiaddr = require('multiaddr');
|
||||
|
||||
export declare interface Mafmt {
|
||||
toString(): string;
|
||||
input?: (Mafmt | (() => Mafmt))[];
|
||||
matches: (a: string | Buffer | Multiaddr) => boolean;
|
||||
partialMatch: (protos: string[]) => boolean;
|
||||
}
|
||||
|
||||
export const DNS: Mafmt;
|
||||
export const DNS4: Mafmt;
|
||||
export const DNS6: Mafmt;
|
||||
export const IP: Mafmt;
|
||||
export const TCP: Mafmt;
|
||||
export const UDP: Mafmt;
|
||||
export const UTP: Mafmt;
|
||||
export const HTTP: Mafmt;
|
||||
export const HTTPS: Mafmt;
|
||||
export const WebSockets: Mafmt;
|
||||
export const WebSocketsSecure: Mafmt;
|
||||
export const WebSocketStar: Mafmt;
|
||||
export const WebRTCStar: Mafmt;
|
||||
export const WebRTCDirect: Mafmt;
|
||||
export const Reliable: Mafmt;
|
||||
export const Stardust: Mafmt;
|
||||
export const Circuit: Mafmt;
|
||||
export const P2P: Mafmt;
|
||||
export const IPFS: Mafmt;
|
38
tsconfig.json
Normal file
38
tsconfig.json
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"target": "ES5",
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"mafmt": [
|
||||
"./src",
|
||||
"../src",
|
||||
]
|
||||
},
|
||||
"types": [
|
||||
"node",
|
||||
"mocha",
|
||||
"chai"
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"./src/index.d.ts",
|
||||
],
|
||||
"include": [
|
||||
"./test/**/*.spec.js"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user