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

💅 useShorthandFunctionType suggests incorrect fix for union or intersection #2595

Closed
1 task done
Milly opened this issue Apr 25, 2024 · 0 comments · Fixed by #2601
Closed
1 task done

💅 useShorthandFunctionType suggests incorrect fix for union or intersection #2595

Milly opened this issue Apr 25, 2024 · 0 comments · Fixed by #2601
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@Milly
Copy link

Milly commented Apr 25, 2024

Environment information

CLI:
  Version:                      1.7.1
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v18.18.2"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Linter:
  Recommended:                  true
  All:                          false
  Rules:
Workspace:
  Open Documents:               0

Rule name

useShorthandFunctionType

Playground link

https://biomejs.dev/playground/?lintRules=all&code=LwAvACAATwBiAGoAZQBjAHQAIAB0AHkAcABlACAAdwBpAHQAaAAgAGMAYQBsAGwAIABzAGkAZwBuAGEAdAB1AHIAZQAgAGEAcwAgAGEAIAB0AHkAcABlACAAdQBuAGkAbwBuACAAbQBlAG0AYgBlAHIACgBlAHgAcABvAHIAdAAgAHQAeQBwAGUAIABVAG4AaQBvAG4AVwBpAHQAaABDAGEAbABsAFMAaQBnAG4AYQB0AHUAcgBlACAAPQAgAHsAIAAoACkAOgAgAHMAdAByAGkAbgBnACAAfQAgAHwAIABzAHQAcgBpAG4AZwA7AAoACgAvAC8AIABPAGIAagBlAGMAdAAgAHQAeQBwAGUAIAB3AGkAdABoACAAYwBhAGwAbAAgAHMAaQBnAG4AYQB0AHUAcgBlACAAYQBzACAAYQAgAHQAeQBwAGUAIABpAG4AdABlAHIAcwBlAGMAdABpAG8AbgAgAG0AZQBtAGIAZQByAAoAZQB4AHAAbwByAHQAIAB0AHkAcABlACAASQBuAHQAZQByAHMAZQBjAHQAaQBvAG4AVwBpAHQAaABDAGEAbABsAFMAaQBnAG4AYQB0AHUAcgBlACAAPQAgAHsAIAAoACkAOgAgAHMAdAByAGkAbgBnACAAfQAgACYAIABzAHQAcgBpAG4AZwA7AAoA

Expected result

It should suggest

// Object type with call signature as a type union member
export type UnionWithCallSignature = (() => string) | string;

// Object type with call signature as a type intersection member
export type IntersectionWithCallSignature = (() => string) & string;

Instead of

// Object type with call signature as a type union member
export type UnionWithCallSignature = () => string | string;

// Object type with call signature as a type intersection member
export type IntersectionWithCallSignature = () => string & string;

It should be a union (or intersection) of the function and the following type, but instead it is a union of the function's return type.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants