TypeScript/tests/baselines/reference/contextualOverloadListFromUnionWithPrimitiveNoImplicitAny.errors.txt
Wesley Wigham 5a1d30815b
Combine multiple overloads into a single contextual signature (#42620)
* When noImplicitAny is set, combine multiple contextual overloads into a single signature, rather than producing `any` and an error

* Amalgamate intersection composite signature return types as intersections, rather than the prior exclusively union behavior

* Add another example from an issue, albeit slightly modified

* Fix newlines, add test from DT

* Interior remodelling
2021-02-22 13:34:47 -08:00

21 lines
835 B
Plaintext

tests/cases/compiler/contextualOverloadListFromUnionWithPrimitiveNoImplicitAny.ts(13,20): error TS7006: Parameter 'match' implicitly has an 'any' type.
==== tests/cases/compiler/contextualOverloadListFromUnionWithPrimitiveNoImplicitAny.ts (1 errors) ====
// must target esnext for `String.normalize` to exist
type Validate = (text: string, pos: number, self: Rule) => number | boolean;
interface FullRule {
validate: string | RegExp | Validate;
normalize?: (match: {x: string}) => void;
}
type Rule = string | FullRule;
const obj: {field: Rule} = {
field: {
validate: (_t, _p, _s) => false,
normalize: match => match.x,
~~~~~
!!! error TS7006: Parameter 'match' implicitly has an 'any' type.
}
};