Skip to content

Commit

Permalink
Fix ts. Closes #938
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Sep 1, 2019
1 parent 7a2ced4 commit ff951b9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 33 deletions.
3 changes: 2 additions & 1 deletion lib/types.js
Expand Up @@ -33,7 +33,8 @@ const internals = {
2540, // Cannot assign to readonly property
2322, // Type is not assignable to other type
2314, // Generic type requires type arguments
2554 // Expected arguments but got other
2554, // Expected arguments but got other
2769 // No overload matches this call
]
};

Expand Down
14 changes: 0 additions & 14 deletions test/cli_coverage/node_modules/module/module.js

This file was deleted.

56 changes: 38 additions & 18 deletions test/types.js
Expand Up @@ -62,69 +62,89 @@ describe('Types', () => {
const errors = await Lab.types.validate();
expect(errors).to.only.contain([
{
column: 4,
filename: 'test/index.ts',
message: 'No overload matches this call.\n' +
` Overload 1 of 2, '(a: string, b: string): string', gave the following error.\n` +
` Argument of type '1' is not assignable to parameter of type 'string'.\n` +
` Overload 2 of 2, '(a: number, b: number): number', gave the following error.\n` +
` Argument of type '"x"' is not assignable to parameter of type 'number'.`,
line: 3,
message: 'Argument of type \'"x"\' is not assignable to parameter of type \'number\'.'
column: 0
},
{
column: 7,
filename: 'test/index.ts',
message: 'No overload matches this call.\n' +
` Overload 1 of 2, '(a: string, b: string): string', gave the following error.\n` +
` Argument of type '1' is not assignable to parameter of type 'string'.\n` +
` Overload 2 of 2, '(a: number, b: number): number', gave the following error.\n` +
` Argument of type '"x"' is not assignable to parameter of type 'number'.`,
line: 4,
message: 'Argument of type \'"x"\' is not assignable to parameter of type \'number\'.'
column: 0
},
{
column: 7,
filename: 'test/nested.ts',
message: 'No overload matches this call.\n' +
` Overload 1 of 2, '(a: string, b: string): string', gave the following error.\n` +
` Argument of type '1' is not assignable to parameter of type 'string'.\n` +
` Overload 2 of 2, '(a: number, b: number): number', gave the following error.\n` +
` Argument of type 'true' is not assignable to parameter of type 'number'.`,
line: 8,
message: 'Argument of type \'true\' is not assignable to parameter of type \'number\'.'
column: 0
},
{
column: 49,
filename: 'test/nested.ts',
message: 'No overload matches this call.\n' +
` Overload 1 of 2, '(a: string, b: string): string', gave the following error.\n` +
` Argument of type '1' is not assignable to parameter of type 'string'.\n` +
` Overload 2 of 2, '(a: number, b: number): number', gave the following error.\n` +
` Argument of type 'true' is not assignable to parameter of type 'number'.`,
line: 8,
message: 'Argument of type \'true\' is not assignable to parameter of type \'number\'.'
column: 42
},
{
column: 4,
filename: 'test/other.ts',
message: 'No overload matches this call.\n' +
` Overload 1 of 2, '(a: string, b: string): string', gave the following error.\n` +
` Argument of type 'true' is not assignable to parameter of type 'string'.\n` +
` Overload 2 of 2, '(a: number, b: number): number', gave the following error.\n` +
` Argument of type 'true' is not assignable to parameter of type 'number'.`,
line: 3,
message: 'Argument of type \'true\' is not assignable to parameter of type \'number\'.'
column: 4
},
{
column: 26,
filename: 'test/syntax.ts',
message: `')' expected.`,
line: 8,
message: '\')\' expected.'
column: 26
},
{
column: 21,
filename: 'test/syntax.ts',
message: `',' expected.`,
line: 9,
message: '\',\' expected.'
column: 21
},
{
column: 0,
filename: 'test/syntax.ts',
line: 8,
column: 0,
message: 'Expected an error'
},
{
column: 0,
filename: 'test/syntax.ts',
line: 9,
column: 0,
message: 'Expected an error'
},
{
column: 0,
filename: 'test/value.ts',
line: 9,
column: 0,
message: 'Expected an error'
},
{
column: 8,
filename: 'test/value.ts',
line: 17,
column: 8,
message: 'Expected an error'
}
]);
Expand Down

0 comments on commit ff951b9

Please sign in to comment.