Support for properties in the parent type
See original GitHub issueUnassigned rule calls create a parent-child relation, and in the example below, AbstractToken
is a parent of TokenA
, TokenB
and TokenC
. AbstractToken
also has own property cardinality.
AbstractToken:
( TokenA
| TokenB
| TokenC
) cardinality=('?'|'+'|'*')?;
However, types generation only reflects reflects ownership, not inheritance. Generated types:
export interface AbstractToken extends AstNode {
cardinality?: '*' | '+' | '?'
}
// similar to `TokenB` and `TokenC`
export TokenA extends AstNode {
...
}
Since inheritance is reflected by union type for the purpose of property lifting, we should generate the types in the above case as follows:
export type AbstractToken = (TokenA | TokenB | TokenC) & { cardinality?: '*' | '+' | '?' }
Issue Analytics
- State:
- Created a year ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Typescript not recognizing properties on the parent class?
Since not all versions of TypeScript support abstract properties directly, this solution should work in any case: export abstract class ...
Read more >Inheritance - CSS: Cascading Style Sheets - MDN Web Docs
CSS properties can be categorized in two types: inherited properties, which by default are set to the computed value of the parent element ......
Read more >AccessibleObject.Parent Property (System.Windows.Forms)
This code excerpt demonstrates overriding the Parent property. See the AccessibleObject class overview for the complete code example.
Read more >Python Inheritance - W3Schools
Inheritance allows us to define a class that inherits all the methods and properties from another class. Parent class is the class being...
Read more >How to optimize parent class property in sub class table
1) Create a same property in the child class with same as parent class. Optimize and delete the property from the child class....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, that makes sense. At least we can take a pause to think more about it. I move the milestone.
@pluralia I think now I understood what you mean. But nobody forces us to do this lifting, it’s really just a convenience feature. We could simply decide not to do any property lifting ourselves here and see whether it’s a real problem in languages that have such constructs. WDYT?