Complete code following the instructions, so that lines followed by
# expect-type-error
(if any) fail type check, while others can pass.
Hit the "▶️ Run" button to see result.
"""
TODO:
Define a `Tree` type. `Tree` is a dictionary, whose keys are string, values are also `Tree`.
"""
Tree = ...
Stuck? Check out solution
xxxxxxxxxx
def f(t: Tree):
pass
f({})
f({"foo": {}})
f({"foo": {"bar": {}}})
f({"foo": {"bar": {"baz": {}}}})
f(1) # expect-type-error
f({"foo": []}) # expect-type-error
f({"foo": {1: {}}}) # expect-type-error