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

Remove unnecessary use of "tostring". #734

Merged
merged 2 commits into from Dec 16, 2020

Conversation

johnnylam88
Copy link
Contributor

There is no need to call "tostring" after we've checked that it's
already a string. Simply use "as string" to help with type
assertion.

This commit is a small optimization, but is mostly to test that
my development environment works correctly to use nodejs
to turn TypeScript into Lua correctly.

There is no need to call "tostring" after we've checked that it's
already a string. Simply use "as string" to help with type
assertion.
@@ -86,7 +86,7 @@ export class Covenant {
if (isNumber(covenant)) {
return ReturnBoolean(this.covenantId === covenant);
} else if (isString(covenant)) {
const name = tostring(covenant);
const name = covenant as string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, when I originally submitted the changes to covenant.ts, the check bot on GitHub complained about errors during the compile phase, but when I run them locally now, the errors aren't there. I will change this a bit more.

@Sidoine Sidoine merged commit b07880b into Sidoine:master Dec 16, 2020
@johnnylam88 johnnylam88 deleted the bugfix/unneeded-tostring branch December 16, 2020 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants