You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, a Doc or a shared type (Map, Array...) don't allow type annotations. This prevents catching errors at static analysis, or editor completion support.
Proposed Solution
Support type annotations on Doc and shared types. For instance:
frompycrdtimportArray, Doc, Mapdoc=Doc()
map0: Map[bool] =doc.get("map0", type=Map)
array0: Array[int] =doc.get("array0", type=Array)
map0["foo"] ="bar"# error: Incompatible types in assignment (expression has type "str", target has type "bool") [assignment]array0.append("baz") # error: Argument 1 to "append" of "Array" has incompatible type "str"; expected "int" [arg-type]
Additional context
Some support for dynamic document validation was introduced in #38 (see also #65), but this issue is bout static typing.
The text was updated successfully, but these errors were encountered:
Problem
Currently, a
Doc
or a shared type (Map
,Array
...) don't allow type annotations. This prevents catching errors at static analysis, or editor completion support.Proposed Solution
Support type annotations on
Doc
and shared types. For instance:Additional context
Some support for dynamic document validation was introduced in #38 (see also #65), but this issue is bout static typing.
The text was updated successfully, but these errors were encountered: