Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/dts-generator/src/phases/json-fixer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function mergeOverlays(
);
}

const mapLikeProperties = new Set(["methods", "properties"]);
const mapLikeProperties = new Set(["methods", "properties", "events"]);
Comment thread
akudev marked this conversation as resolved.

function mergeProp(
obj: { [key: string]: unknown },
Expand Down
2 changes: 2 additions & 0 deletions packages/dts-generator/src/types/api-json.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ export interface ObjEvent {
examples?: Examples;
references?: References;
allowedFor?: string[];
explicit?: boolean;
}
export interface Ui5Metadata {
stereotype?:
Expand Down Expand Up @@ -453,6 +454,7 @@ export interface Ui5Event {
allowPreventDefault?: boolean;
enableEventBubbling?: boolean;
allowedFor?: string[];
explicit?: boolean;
}
export interface EnumProperty {
name: string;
Expand Down
27 changes: 16 additions & 11 deletions packages/dts-generator/src/utils/json-event-parameter-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,22 @@ function createEventParameterInterfaces(
};
};

function buildProperties(srcProperties) {
function buildProperties(srcProperties, explicit?: boolean) {
const transformedProperties = [];
for (let propertyName in srcProperties) {
const prop = srcProperties[propertyName];
transformedProperties.push(
addJsDocProps(
{
name: prop.name,
type: prop.type,
visibility: "public", // prop.visibility,
},
prop,
),
const transformed = addJsDocProps(
{
name: prop.name,
type: prop.type,
visibility: "public", // prop.visibility,
},
prop,
);
if (explicit && prop.optional === false) {
transformed.optional = false;
}
transformedProperties.push(transformed);
}
return transformedProperties;
}
Expand Down Expand Up @@ -320,7 +322,10 @@ function createEventParameterInterfaces(
}

// now add the parameters to the interface
const parameters = buildProperties(allParameters);
const parameters = buildProperties(
allParameters,
event.explicit === true,
);
Comment thread
akudev marked this conversation as resolved.
eventParametersInterface.properties = parameters;
eventParametersInterface.description = `Parameters of the ${symbol.basename}#${event.name} event.`;
if (event.deprecated) {
Expand Down
Loading
Loading