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

[helpers ts conversion] temporal dead zone #16520

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* @minVersion 7.5.5 */

export default function _tdzError(name) {
export default function _tdzError(name: string): never {
throw new ReferenceError(name + " is not defined - temporal dead zone");
}
8 changes: 0 additions & 8 deletions packages/babel-helpers/src/helpers/temporalRef.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/babel-helpers/src/helpers/temporalRef.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* @minVersion 7.0.0-beta.0 */

import undef from "./temporalUndefined.ts";
import err from "./tdz.ts";

export default function _temporalRef<T>(val: T, name: string) {
return val === undef ? err(name) : val;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

// This function isn't mean to be called, but to be used as a reference.
// We can't use a normal object because it isn't hoisted.
export default function _temporalUndefined() {}
export default function _temporalUndefined(): void {}
amjed-98 marked this conversation as resolved.
Show resolved Hide resolved