Skip to content

Types, Values, Properties - TypeSpec's types #3128

Discussion options

You must be logged in to vote

First lets separate the bugs:

model B {
  foo: A.foo::type;
}

This is broken today, however what it would mean is that the property type of B.foo is exactly a string(would be the equivalent of doing A["foo"] in typescript

Now for referencing properties:

When you reference a property it is its own type(that property) this means even though the property type is a string, you cannot assign a string to i(why 2nd and last case fails as overrides need to be assignable to the parent). The issue is that the property can contain additional information which could make it incorrect to assume it is interchangeable with its type.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@I-Al-Istannen
Comment options

Answer selected by I-Al-Istannen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants