-
Notifications
You must be signed in to change notification settings - Fork 12.8k
unique symbol type imported in declaration files used as computed property key can not be named #38516
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
Comments
@weswigham, I could use your advice on this one. From what I can tell, it was a bizarre happy accident that this ever worked correctly, and it was “broken” by correctly setting I found that I can fix this particular example by considering not just exports, but also members, of the function getCandidateListForSymbol(symbolFromSymbolTable: Symbol, resolvedImportedSymbol: Symbol, ignoreQualification: boolean | undefined) {
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
}
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
// but only if the symbolFromSymbolTable can be qualified
const candidateTable = getExportsOfSymbol(resolvedImportedSymbol);
const accessibleSymbolsFromExports = candidateTable && getAccessibleSymbolChainFromSymbolTable(candidateTable, /*ignoreQualification*/ true);
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
}
+ const type = getTypeOfSymbol(resolvedImportedSymbol);
+ if (type.flags & TypeFlags.Object) {
+ const membersCandidateTable = resolveStructuredTypeMembers(type as ObjectType).members;
+ const accessibleSymbolsFromMembers = getAccessibleSymbolChainFromSymbolTable(membersCandidateTable, /*ignoreQualification*/ true);
+ if (accessibleSymbolsFromMembers && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
+ return [symbolFromSymbolTable].concat(accessibleSymbolsFromMembers);
+ }
+ }
} However, that breaks a bunch of tests by eagerly selecting a much worse serialization when a better one would have eventually been found in another symbol table. It seems like I want something similar to this only after other attempts to find an accessible symbol chain have failed. But all this symbol accessibility stuff is a little opaque to me. |
If you want to add a lower priority container, You're absolutely right that symbol visibility is a bit of a mess, though! It's also not terribly performant, as it's an uncached exhaustive search of reachable symbols! But it's also quite hard to replace, what with all the visibility rules encoded into it :S |
TypeScript Version: 3.8 and 3.9.2
This is a regression from 3.7.
Search Terms:
unique symbol, index signature
Code
This is a distilled code from a bigger codebase. The
Op
is imported from Sequelizetsconfig.json
Expected behavior:
No Error
Actual behavior:
Related Issues:
#9944
The text was updated successfully, but these errors were encountered: