Skip to content

Empty use declarations now delete exported elements #1300

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

Merged

Conversation

DuncanUszkay1
Copy link
Contributor

Issue: #1296

With this PR, you can now specify an empty use statement to prevent an implementation from being injected with the following syntax: --use Date=. When attempting to use date, which is normally globally exported automatically, you will then instead get this error message:

ERROR TS2304: Cannot find name 'Date'.

 Date.now();
 ~~~~
 in main.ts(1,1)

ERROR: 1 compile error(s)

This is useful when you cannot support the module in question, which in the case of date would be due to the fact that the host will not import it.

@dcodeIO
Copy link
Member

dcodeIO commented May 27, 2020

Let's add a simple test for this to make sure that unrelated changes don't accidentally break the behavior. Suggesting to use the Date object as a test dummy.

@dcodeIO dcodeIO merged commit 47e42b5 into AssemblyScript:master May 27, 2020
@dcodeIO
Copy link
Member

dcodeIO commented May 27, 2020

Great, thanks!

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.

2 participants