MCPcopy Create free account
hub / github.com/middleapi/orpc / type

Function type

packages/contract/src/schema.ts:25–39  ·  view source on GitHub ↗
(...[map]: TypeRest<TInput, TOutput>)

Source from the content-addressed store, hash-verified

23 * @see {@link https://orpc.dev/docs/procedure#type-utility Type Utility Docs}
24 */
25export function type<TInput, TOutput = TInput>(...[map]: TypeRest<TInput, TOutput>): Schema<TInput, TOutput> {
26 return {
27 '~standard': {
28 vendor: 'custom',
29 version: 1,
30 async validate(value) {
31 if (map) {
32 return { value: await map(value as TInput) as TOutput }
33 }
34
35 return { value: value as TOutput }
36 },
37 },
38 }
39}

Callers 8

schema.test-d.tsFile · 0.90
schema.test.tsFile · 0.90
contract.tsFile · 0.90
converter.test.tsFile · 0.85
object.test.tsFile · 0.85
middleware.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected