Skip to content

Some refactoring so we arent checking undefined on program or asserting it so much #58782

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
merged 1 commit into from
Jun 5, 2024

Conversation

sheetalkamat
Copy link
Member

No description provided.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 5, 2024
@@ -329,8 +329,8 @@ function createTabularErrorsDisplay(filesInError: (ReportFileInError | undefined
}

/** @internal */
export function isBuilderProgram(program: Program | BuilderProgram): program is BuilderProgram {
return !!(program as BuilderProgram).getState;
export function isBuilderProgram<T extends BuilderProgram>(program: Program | BuilderProgram): program is T {
Copy link
Member

Choose a reason for hiding this comment

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

This seems unsafe; this could conform to anything, right?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's copied from somewhere else...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Reminds me that we should see if we can make Debug.checkDefined or Debug.assert reject always-defined or never-falsy values (statically or at lint time), in case there are more of these that could be removed.

@sheetalkamat sheetalkamat merged commit b9d96df into main Jun 5, 2024
28 checks passed
@sheetalkamat sheetalkamat deleted the builderProgramState branch June 5, 2024 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants