Skip to content

Conversation

grumd
Copy link
Contributor

@grumd grumd commented Mar 12, 2021

Fixes #2864

Gist of it:

explicit-module-boundary-types and explicit-function-return-type both have an option allowTypedFunctionExpressions.
It makes this code correct:

interface ObjectType {
  foo(): number;
}
export const obj: ObjectType = {
  foo: () => 1,
};

The issue is that the following code is not correct even with the option set to true:

interface ObjectType {
  foo: { bar: () => number }; 
}
export const obj: ObjectType = {
  foo: { bar: () => 1 },
};

My PR fixes the issue for both of these rules and adds relevant tests.

My fork can be used with npm/yarn using this, that's what I temporarily will do.

"@typescript-eslint/eslint-plugin": "https://gitpkg.now.sh/grumd/typescript-eslint/packages/eslint-plugin?build",

…dary-types and functions in nested object properties
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @grumd!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

Copy link
Collaborator

@armano2 armano2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add unit tests for explicit-module-boundary-types

@bradzacher bradzacher added the bug Something isn't working label Mar 12, 2021
@grumd
Copy link
Contributor Author

grumd commented Mar 12, 2021

can you add unit tests for explicit-module-boundary-types

Added

@grumd grumd requested a review from armano2 March 12, 2021 17:41
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@bradzacher bradzacher merged commit 55e1fba into typescript-eslint:master Mar 15, 2021
This was referenced Mar 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[explicit-module-boundary-types] does not respect functions exported within nested object literals
3 participants