question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ts-interface-generator does not parse properties of type `Array` properly

See original GitHub issue

Consider 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:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
akudevcommented, Jul 22, 2022

FYI: the “next release” (0.5.1) was done this week.

1reaction
akudevcommented, Jul 6, 2022

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found