Namespace / mangle type names made global in externs
See original GitHub issueCurrently, a TypeScript file containing ambient declarations writes out a secondary externs file:
declare interface Foo { ... }
Generates an externs.js
:
/** @interface */
function Foo() {}
The problem is that Foo
in the externs file is a global type, whereas the Foo
in the TypeScript file was scoped to the local module. Thus, multiple Foo
s in multiple files can conflict.
A potential fix would be to namespace/mangle Foo
as e.g. _tsickle_extern_path_to_the_file_Foo
and then include an alias in the Closure output (something like var Foo = _tsickle_extern_path_to_the_file_Foo;
).
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Name Mangling in C++ - extern - Stack Overflow
1 Each name declared as an object with external linkage in a header is reserved to the implementation to designate that library object...
Read more >Name Mangling and extern "C" in C++ - GeeksforGeeks
In C, names may not be mangled as it doesn't support function overloading. So how to make sure that name of a symbol...
Read more >Name mangling (C++ only) - IBM
Name mangling is the encoding of function and variable names into unique names so that linkers can separate common names in the language....
Read more >Name mangling - Wikipedia
The need for name mangling arises where the language allows different entities to be named with the same identifier as long as they...
Read more >Name mangling in C - Jens Gustedt's Blog
Most will know that C++ mangles external names in a compiler specific way such that they encode the types of function parameters and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@b-strauss within a
goog.module
, all symbols, including types, are scoped to the local file, and can only be seen “on the outside” through explicitly exporting them. So there’s no conflict there.Fixed a while ago.