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

update generated diagnostic messages for isolated declarations #59562

Closed

Conversation

iisaduan
Copy link
Member

@iisaduan iisaduan commented Aug 8, 2024

In investigating adopting isolated declarations (#59097), I found that the generated Diagnostics needs a type annotation. This updates the script so we're able to provide a type annotation for it.

(this PR does not turn on the flag but once I make the PR that turns on the flag, I'll link it here: ____)

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 8, 2024
result.push("};");

return result.join("\r\n");
return result.join("\r\n") + interfaceResult.join("\r\n");
Copy link
Member

Choose a reason for hiding this comment

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

Can you put the interface first? It doesn't matter in practice, but seems better to declare the type before using it.

];
const interfaceResult = ["\r\ninterface Diagnostics {"];
Copy link
Member

Choose a reason for hiding this comment

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

This will have to be exported / internal.

@jakebailey
Copy link
Member

The duplication is unfortunate; I do wonder if there's a better way but I think this is the minimally invasive way.

The only other thing I can think of is like:

export const Diagnostics = {
    Foo: diag() as Diagnostic,
}

But not sure if ID accepts that.

@iisaduan
Copy link
Member Author

iisaduan commented Sep 30, 2024

closed in #59635 (did it there)

@iisaduan iisaduan closed this Sep 30, 2024
@iisaduan iisaduan deleted the isolatedDeclDiagnosticMessages branch September 30, 2024 18:20
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
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants