ty icon indicating copy to clipboard operation
ty copied to clipboard

Unpacking a typed dictionary into another should transfer defined keys.

Open lypwig opened this issue 1 month ago • 1 comments

Summary

from typing import TypedDict

class MyTypedDict1(TypedDict):
    aaa: int
    bbb: int


class MyTypedDict2(TypedDict):
    aaa: int
    bbb: int
    ccc: int

d1: MyTypedDict1 = {
    "aaa": 1,
    "bbb": 2,
}

d2: MyTypedDict2 = {
    **d1,
    "ccc": 3,
}

Missing required key 'aaa' in TypedDict MyTypedDict2 constructor (missing-typed-dict-key) [Ln 18, Col 20] Missing required key 'bbb' in TypedDict MyTypedDict2 constructor (missing-typed-dict-key) [Ln 18, Col 20]

https://play.ty.dev/5bf7c51c-fb7d-4a32-8fc3-799f1e014d76

Version

0.0.1a25

lypwig avatar Nov 06 '25 07:11 lypwig