parent
7317226c80
commit
d4869045c2
3 changed files with 71 additions and 69 deletions
|
|
@ -21,8 +21,8 @@ const {document} = window;
|
|||
const createDomElement = (element: string) => document.createElement(element);
|
||||
|
||||
interface Test {
|
||||
is(value: any): boolean;
|
||||
fixtures: any[];
|
||||
is(value: unknown): boolean;
|
||||
fixtures: unknown[];
|
||||
}
|
||||
|
||||
const types = new Map<string, Test>([
|
||||
|
|
@ -77,7 +77,7 @@ const types = new Map<string, Test>([
|
|||
]
|
||||
}],
|
||||
['numericString', {
|
||||
is: m.numericString,
|
||||
is: is.numericString,
|
||||
fixtures: [
|
||||
'5',
|
||||
'-3.2',
|
||||
|
|
@ -106,7 +106,7 @@ const types = new Map<string, Test>([
|
|||
function () {},
|
||||
() => {},
|
||||
async function () {},
|
||||
function * (): any {}
|
||||
function * (): unknown {}
|
||||
// tslint:enable:no-unused no-empty no-unused-variable only-arrow-functions no-function-expression
|
||||
]
|
||||
}],
|
||||
|
|
@ -377,7 +377,7 @@ const types = new Map<string, Test>([
|
|||
]);
|
||||
|
||||
// This ensures a certain method matches only the types it's supposed to and none of the other methods' types
|
||||
const testType = (t: TestContext & Context<any>, type: string, exclude?: string[]) => {
|
||||
const testType = (t: TestContext & Context<unknown>, type: string, exclude?: string[]) => {
|
||||
const testData = types.get(type);
|
||||
|
||||
if (testData === undefined) {
|
||||
|
|
@ -436,8 +436,8 @@ test('is.symbol', t => {
|
|||
|
||||
test('is.numericString', t => {
|
||||
testType(t, 'numericString');
|
||||
t.false(m.numericString(''));
|
||||
t.false(m.numericString(1));
|
||||
t.false(is.numericString(''));
|
||||
t.false(is.numericString(1));
|
||||
});
|
||||
|
||||
test('is.array', t => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue