map < input > ( ) : Chainable < MapP < input , unknown , unknown > > Returns Chainable < MapP < input , unknown , unknown > > Defined in node_modules/ts-pattern/dist/patterns.d.ts:117 map < input , const pkey , const pvalue > ( patternKey , patternValue ) : Chainable < MapP < input , pkey , pvalue > > Type Parameters input const pkey extends readonly [ ] | readonly [ unknown , unknown ] | readonly [ unknown , unknown ] | { [k : string ]: unknown ; } | Primitives | UnknownMatcher | readonly UnknownPattern [] | readonly [ UnknownPattern , UnknownPattern ] | readonly [ UnknownPattern , UnknownPattern ] | PatternMatcher < WithDefault < UnwrapMapKey < input > , unknown > > | { readonly [ k in string | number | symbol ] ?: Pattern < Readonly < MergeUnion < Exclude < WithDefault < UnwrapMapKey < input > , unknown > , ( readonly any[] | Primitives | Map<any, any> | Set<any>) > > > [ k ] > } const pvalue extends readonly [ ] | readonly [ unknown , unknown ] | readonly [ unknown , unknown ] | { [k : string ]: unknown ; } | Primitives | UnknownMatcher | readonly UnknownPattern [] | readonly [ UnknownPattern , UnknownPattern ] | readonly [ UnknownPattern , UnknownPattern ] | PatternMatcher < WithDefault < UnwrapMapValue < input > , unknown > > | { readonly [ k in string | number | symbol ] ?: Pattern < Readonly < MergeUnion < Exclude < WithDefault < UnwrapMapValue < input > , unknown > , ( readonly any[] | Primitives | Map<any, any> | Set<any>) > > > [ k ] > } Defined in node_modules/ts-pattern/dist/patterns.d.ts:118
P.map(keyPattern, valuePattern)
takes a subpattern to match against the key, a subpattern to match against the value and returns a pattern that matches on maps where all elements inside the map match those two subpatterns.Read
P.map
documentation on GitHub