Microsoft/TypeScript
GitHub ã§èŠãRegression: incorrect return type when disabled strictNullChecks
Open
#60,187 opened on 2024幎10æ10æ¥
Domain: check: Type InferenceHelp WantedPossible Improvement
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
"ts7011", "strictnullchecks"
ð Version & Regression Information
- This changed between versions 5.6.3 and 5.7.0-beta (also in 5.7.0-dev.20241010)
When disabled strictNullChecks in tsconfig.json error TS7011: Function expression, which lacks return-type annotation, implicitly has an T return type
⯠Playground Link
ð» Code
declare function wildcardToRegExp(s: string): RegExp | null;
const rules = ['a', 'b'].flatMap(rule => wildcardToRegExp(rule) || []); // if flatMap<RegExp> - no error
ð Actual behavior
TS7011: Function expression, which lacks return-type annotation, implicitly has an 'RegExp | any[]' return type.
ð Expected behavior
No error
Additional information about the issue
No response