Skip to content

Commit

Permalink
fix(eslint-plugin): [explicit-module-boundary-types] dont report retu…
Browse files Browse the repository at this point in the history
…rn type errors on constructor overloads (#2158)
  • Loading branch information
bradzacher committed Jun 2, 2020
1 parent de18660 commit 53232d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Expand Up @@ -380,7 +380,10 @@ export default util.createRule<Options, MessageIds>({
function checkEmptyBodyFunctionExpression(
node: TSESTree.TSEmptyBodyFunctionExpression,
): void {
if (!node.returnType) {
const isConstructor =
node.parent?.type === AST_NODE_TYPES.MethodDefinition &&
node.parent.kind === 'constructor';
if (!isConstructor && !node.returnType) {
context.report({
node,
messageId: 'missingReturnType',
Expand Down
Expand Up @@ -82,6 +82,25 @@ export class Test {
}
`,
},
{
// https://github.com/typescript-eslint/typescript-eslint/issues/2150
code: `
export class Test {
constructor();
constructor(value?: string) {
console.log(value);
}
}
`,
},
{
code: `
declare class MyClass {
constructor(options?: MyClass.Options);
}
export { MyClass };
`,
},
{
code: `
export function test(): void {
Expand Down

0 comments on commit 53232d7

Please sign in to comment.