ts-interface-generator does not parse properties of type `Array` properly
See original GitHub issueConsider the following class:
import ComboBox from 'sap/m/ComboBox'; /** * @name my.namespace.MyComboBox */ export default class MyComboBox extends ComboBox { static readonly metadata = { library: 'my.namespace', properties: { filters: { type: 'sap.ui.model.Filter[]', defaultValue: [], } }, }; }
The MyComboBox.gen.d.ts
file has then this auto-generated line: import Filter[] from "sap/ui/model/Filter[]";
, i.e. when the aggregation is of type Something[]
, the generator considers the characters [
and ]
to be part of the name.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[Feature] [TYPESCRIPT] Generator parses to Array instead of ...
I use openapi-generator-cli generate -g typescript-angular to generate a client to use in my angular application. This results in an interface ...
Read more >Typescript narrowing unable to parse out property type
I have kept the obj.prop part of the condition, but note that it does not accept the empty string. The obj.prop !== undefined...
Read more >Handbook - Interfaces - TypeScript
Not all properties of an interface may be required. ... TypeScript comes with a ReadonlyArray<T> type that is the same as Array<T> with...
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >Type-safely parsing JSON to a TypeScript Interface
Let's say we're working with a REST API that returns a JSON string representing a user. The JSON API agrees to a contract...
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
FYI: the “next release” (0.5.1) was done this week.
Well, in general it is better to use an aggregation of Elements instead of an array property, so changes within the array/list also trigger invalidation, but yeah, in some cases arrays are needed, so this needs to be fixed. Thanks for reporting!