-
Notifications
You must be signed in to change notification settings - Fork 109
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
String enums are converted to externs with empty strings enums #1412
Comments
Can you expand on why you think the value should be there? The value of the
enum field in the externs should never matter to Closure Compiler - the
compiler doesn't do anything with it.
|
I'm converting chrome types to closure compiler externs using tsickle. |
But what piece of the toolchain would be using that string? Closure
Compiler doesn't, and by definition the externs are not present at runtime.
|
Here is an use case /** @enum {string} */
chrome.declarativeNetRequest.RuleActionType = {
BLOCK: '',
REDIRECT: '',
ALLOW: '',
UPGRADE_SCHEME: '',
MODIFY_HEADERS: '',
ALLOW_ALL_REQUESTS: '',
}; Then I run closure compiler to compile this javascript code void chrome.declarativeNetRequest.updateDynamicRules({
addRules: [
{
id: 1,
priority: 1,
action: {
type: chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,
responseHeaders: [
{
header: "Access-Control-Allow-Origin",
operation: chrome.declarativeNetRequest.HeaderOperation.SET,
value: "*"
}
]
},
condition: {
urlFilter: "<all_urls>",
resourceTypes: [chrome.declarativeNetRequest.ResourceType.MAIN_FRAME]
}
}
],
removeRuleIds: [1]
}); The issue is that closure compiler will replace |
You need to make sure closure compiler understands that the externs file is
in fact an externs file, either by putting ***@***.***" on top of it or by
explicitly passing it as an externs file on the command line.
Closure Compiler should then leave references to these external symbols as
they were in the original source.
… Message ID: ***@***.***>
|
If we have this enum
The generated extern is
It should be
The text was updated successfully, but these errors were encountered: