Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[explicit-module-boundary-types] Warning for Return Types and Argument Types on Nested Functions #2925

Closed
3 tasks done
ccaspers opened this issue Jan 7, 2021 · 1 comment
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@ccaspers
Copy link

ccaspers commented Jan 7, 2021

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

Fully working repro can be found here: https://github.com/ccaspers/explicit-module-boundary-types

module.exports = {
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/recommended"
    ],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaVersion": 12,
        "sourceType": "module"
    },
    "plugins": [
        "@typescript-eslint"
    ],
    "rules": {
    }
};
/* works as expected */
interface Transformer {
  apply(input: number): string;
}

const impl: Transformer = {
  apply(input) {
    return input.toString();
  },
};

/* produces unexpected warnings */
interface NestedTransformer {
  nested: {
    apply(input: number): string;
  };
}

const nestedImpl: NestedTransformer = {
  nested: {
    // Missing return type on function.eslint@typescript-eslint/explicit-module-boundary-types
    // Argument 'input' should be typed.eslint@typescript-eslint/explicit-module-boundary-types
    apply(input) {
      return input.toString();
    },
  },
};

export default {
  impl,
  nestedImpl,
};

Expected Result
There are no warnings for the nested apply function.

Actual Result
There are warnings for the nested apply function.

The following warnings were produced, even though the object is fully typed using an interface:

  • Missing return type on function.eslint@typescript-eslint/explicit-module-boundary-types
  • Argument 'input' should be typed.eslint@typescript-eslint/explicit-module-boundary-types

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 4.12.0
@typescript-eslint/parser 4.12.0
TypeScript 4.1.3
ESLint 7.17.0
node 12.19.1
@ccaspers ccaspers added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jan 7, 2021
@ccaspers
Copy link
Author

ccaspers commented Jan 7, 2021

Sorry I should have used the search function before posting this. It's a duplicate of #2864

@ccaspers ccaspers closed this as completed Jan 7, 2021
@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Jan 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants