Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle problematic return types. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//
// Created by Thijs Wenker and Milad Nazeri on 1/31/18
// Copyright 2018 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
//
// Creates Type Script Definitions for Hifi
// Creates TypeScript Definitions for Overte
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
Expand Down Expand Up @@ -98,7 +99,13 @@ function getDescription(item, scopeDepth) {
descriptionBody += bodyParams.join("");
}
if (item.returns) {
descriptionBody += `${ident} * @returns {${item.returns[0].type.names[0]}} ${LINE_BREAK}`;
if (item.returns[0].type) {
descriptionBody += `${ident} * @returns {${item.returns[0].type.names[0]}} ${LINE_BREAK}`;
} else if (item.returns[0].description) {
descriptionBody += `${ident} * @returns ${item.returns[0].description} ${LINE_BREAK}`;
} else {
console.warn(`WARN: ${item.name} returns non-valid return type.`);
}
}
if (descriptionBody.length > 0) {
// Takes care of the Vec3(0) and Quat(0) instances in the description
Expand Down