|
| 1 | +//// [tests/cases/compiler/coAndContraVariantInferences7.ts] //// |
| 2 | + |
| 3 | +=== coAndContraVariantInferences7.ts === |
| 4 | +type Request<TSchema extends Schema> = { |
| 5 | +>Request : Symbol(Request, Decl(coAndContraVariantInferences7.ts, 0, 0)) |
| 6 | +>TSchema : Symbol(TSchema, Decl(coAndContraVariantInferences7.ts, 0, 13)) |
| 7 | +>Schema : Symbol(Schema, Decl(coAndContraVariantInferences7.ts, 2, 2)) |
| 8 | + |
| 9 | + query: TSchema["query"]; |
| 10 | +>query : Symbol(query, Decl(coAndContraVariantInferences7.ts, 0, 40)) |
| 11 | +>TSchema : Symbol(TSchema, Decl(coAndContraVariantInferences7.ts, 0, 13)) |
| 12 | + |
| 13 | +}; |
| 14 | + |
| 15 | +type Schema = { query?: unknown; body?: unknown }; |
| 16 | +>Schema : Symbol(Schema, Decl(coAndContraVariantInferences7.ts, 2, 2)) |
| 17 | +>query : Symbol(query, Decl(coAndContraVariantInferences7.ts, 4, 15)) |
| 18 | +>body : Symbol(body, Decl(coAndContraVariantInferences7.ts, 4, 32)) |
| 19 | + |
| 20 | +declare function route<TSchema extends Schema>(obj: { |
| 21 | +>route : Symbol(route, Decl(coAndContraVariantInferences7.ts, 4, 50)) |
| 22 | +>TSchema : Symbol(TSchema, Decl(coAndContraVariantInferences7.ts, 6, 23)) |
| 23 | +>Schema : Symbol(Schema, Decl(coAndContraVariantInferences7.ts, 2, 2)) |
| 24 | +>obj : Symbol(obj, Decl(coAndContraVariantInferences7.ts, 6, 47)) |
| 25 | + |
| 26 | + pre: (a: TSchema) => void; |
| 27 | +>pre : Symbol(pre, Decl(coAndContraVariantInferences7.ts, 6, 53)) |
| 28 | +>a : Symbol(a, Decl(coAndContraVariantInferences7.ts, 7, 8)) |
| 29 | +>TSchema : Symbol(TSchema, Decl(coAndContraVariantInferences7.ts, 6, 23)) |
| 30 | + |
| 31 | + schema: TSchema; |
| 32 | +>schema : Symbol(schema, Decl(coAndContraVariantInferences7.ts, 7, 28)) |
| 33 | +>TSchema : Symbol(TSchema, Decl(coAndContraVariantInferences7.ts, 6, 23)) |
| 34 | + |
| 35 | + handle: (req: Request<TSchema>) => void; |
| 36 | +>handle : Symbol(handle, Decl(coAndContraVariantInferences7.ts, 8, 18)) |
| 37 | +>req : Symbol(req, Decl(coAndContraVariantInferences7.ts, 9, 11)) |
| 38 | +>Request : Symbol(Request, Decl(coAndContraVariantInferences7.ts, 0, 0)) |
| 39 | +>TSchema : Symbol(TSchema, Decl(coAndContraVariantInferences7.ts, 6, 23)) |
| 40 | + |
| 41 | +}): void; |
| 42 | + |
| 43 | +const validate = (_: { query?: unknown; body?: unknown }) => {}; |
| 44 | +>validate : Symbol(validate, Decl(coAndContraVariantInferences7.ts, 12, 5)) |
| 45 | +>_ : Symbol(_, Decl(coAndContraVariantInferences7.ts, 12, 18)) |
| 46 | +>query : Symbol(query, Decl(coAndContraVariantInferences7.ts, 12, 22)) |
| 47 | +>body : Symbol(body, Decl(coAndContraVariantInferences7.ts, 12, 39)) |
| 48 | + |
| 49 | +route({ |
| 50 | +>route : Symbol(route, Decl(coAndContraVariantInferences7.ts, 4, 50)) |
| 51 | + |
| 52 | + pre: validate, |
| 53 | +>pre : Symbol(pre, Decl(coAndContraVariantInferences7.ts, 14, 7)) |
| 54 | +>validate : Symbol(validate, Decl(coAndContraVariantInferences7.ts, 12, 5)) |
| 55 | + |
| 56 | + schema: { |
| 57 | +>schema : Symbol(schema, Decl(coAndContraVariantInferences7.ts, 15, 16)) |
| 58 | + |
| 59 | + query: "", |
| 60 | +>query : Symbol(query, Decl(coAndContraVariantInferences7.ts, 16, 11)) |
| 61 | + |
| 62 | + }, |
| 63 | + handle: (req) => { |
| 64 | +>handle : Symbol(handle, Decl(coAndContraVariantInferences7.ts, 18, 4)) |
| 65 | +>req : Symbol(req, Decl(coAndContraVariantInferences7.ts, 19, 11)) |
| 66 | + |
| 67 | + const test: string = req.query; |
| 68 | +>test : Symbol(test, Decl(coAndContraVariantInferences7.ts, 20, 9)) |
| 69 | +>req.query : Symbol(query, Decl(coAndContraVariantInferences7.ts, 0, 40)) |
| 70 | +>req : Symbol(req, Decl(coAndContraVariantInferences7.ts, 19, 11)) |
| 71 | +>query : Symbol(query, Decl(coAndContraVariantInferences7.ts, 0, 40)) |
| 72 | + |
| 73 | + }, |
| 74 | +}); |
| 75 | + |
| 76 | +export {}; |
| 77 | + |
0 commit comments