forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@hapi/mimos): rework 4.1 version definition (DefinitelyTyped#44028)
This commit tries to re-align package definition with declared version 4.1 - before it could be moved to v5 - correct export - namespace for types and aliases - test added https://github.com/hapijs/mimos/tree/v4.1.1 /cc @luiso1979 Thanks! Fixes DefinitelyTyped#43987
- Loading branch information
1 parent
c292974
commit cb19b1b
Showing
4 changed files
with
94 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Mimos = require('@hapi/mimos'); | ||
|
||
let mimos: Mimos; | ||
|
||
// new Mimos([options]) | ||
|
||
const options: Mimos.MimosOptions = { | ||
override: { | ||
'node/module': { | ||
source: 'iana', | ||
compressible: true, | ||
extensions: ['node', 'module', 'npm'], | ||
type: 'node/module', | ||
}, | ||
'application/javascript': { | ||
source: 'iana', | ||
charset: 'UTF-8', | ||
compressible: true, | ||
extensions: ['js', 'javascript'], | ||
type: 'text/javascript', | ||
}, | ||
'text/html': { | ||
predicate: mime => { | ||
mime.foo = mime.source === 'iana' ? 'test' : 'bar'; | ||
return mime; | ||
}, | ||
}, | ||
}, | ||
}; | ||
mimos = new Mimos(options); // $ExpectType Mimos | ||
|
||
// mimos.path | ||
|
||
mimos = new Mimos(); | ||
mimos.path('/static/public/app.js'); // $ExpectType MimosOptionsValue | ||
|
||
// mimos.type | ||
|
||
mimos = new Mimos(); | ||
const mime = mimos.type('text/plain'); // $ExpectType MimeEntry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"index.d.ts" | ||
"index.d.ts", | ||
"hapi__mimos-tests.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,3 @@ | ||
{ | ||
"extends": "dtslint/dt.json", | ||
"rules": { | ||
"callable-types": false, | ||
"max-line-length": false, | ||
"no-redundant-jsdoc": false, | ||
"npm-naming": [ | ||
true, | ||
{ | ||
"errors": [ | ||
[ | ||
"NeedsExportEquals", | ||
false | ||
] | ||
], | ||
"mode": "code" | ||
} | ||
], | ||
"prefer-method-signature": false | ||
} | ||
} | ||
"extends": "dtslint/dt.json" | ||
} |