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 the only way you can assign a value to a dynamic interface type is by assigning an expression with no type within a dynamic block on JavaScript.
It was suggested here that we let you assign a typed expression, performing a structural type check. For example:
I don't see a very good reason to not allow this. The work for structural checking of schemas basically parallels the stuff @quintesse already had to do for native, so it's a problem we've already bitten off.
A change we would have to make would be to disallow runtime type checks like is Named, which currently merely evaluate to false. They should be disallowed at compile time.
To be clear: this would amount to Go-style structural typing.
The text was updated successfully, but these errors were encountered:
Then, two completely unrelated types would be subtypes of Foo if they are subtypes of {Anything*} and the type of their member first is a subtype of String...
No, I don't think we should allow that because there are some things that you can do with / assume about ordinary interfaces that you can't do with / assume about dynamic interfaces.
Currently the only way you can assign a value to a
dynamic
interface type is by assigning an expression with no type within adynamic
block on JavaScript.It was suggested here that we let you assign a typed expression, performing a structural type check. For example:
I don't see a very good reason to not allow this. The work for structural checking of schemas basically parallels the stuff @quintesse already had to do for
native
, so it's a problem we've already bitten off.A change we would have to make would be to disallow runtime type checks like
is Named
, which currently merely evaluate tofalse
. They should be disallowed at compile time.To be clear: this would amount to Go-style structural typing.
The text was updated successfully, but these errors were encountered: