Comments (4)
Not sure what to do here yet.
See microsoft/TypeScript#983 which discusses how it's impossible to reference the global-namespaced Error
once the namespace contains a class called Error
.
Maybe we should take all the built-in (non-namespaced) names and move them to the closure-internal namespace, like
class Error extends ಠ_ಠ.cl2dts_internal.Error {}
but then we need to declare all of those, and in practice the externs/esX.js files should model the same stdlib as the lib.d.ts
so maybe we really want this to refer to the Error
class from lib.d.ts
.
from clutz.
We could just have a map of names that are defined in the global scope, like Error
or String
etc, and then alias them with some renaming trick (look of approval? Table flip guy?).
from clutz.
Yep, easiest solution would be to add the following
declare namespace ಠ_ಠ.cl2dts_internal {
type GlobalError = Error;
}
and then just emit GlobalError
instead of Error
when someone was referencing the global Error
. Now the question is whether this should be appended to lib.d.ts
or live in its own .d.ts
that we have to always pass to TSC.
from clutz.
+1 for modifying whatever "standard lib" typescript receives rather than
another explicit input.
There is a way to do this where we don't modify the existing lib.d.ts, but
instead add a lib.closure.d.ts and make that a standard lib. I've seen
hints about how to do that, so I think we could figure it out.
On Tue, Sep 22, 2015 at 5:21 PM Rado Kirov [email protected] wrote:
Yep, easiest solution would be to add the following
declare namespace ಠ_ಠ.cl2dts_internal {
type GlobalError = Error;
}and then just emit GlobalError instead of Error when someone was
referencing the global Error. Now the question is whether this should be
appended to lib.d.ts or live in its own .d.ts that we have to always pass
to TSC.—
Reply to this email directly or view it on GitHub
#81 (comment)
.
from clutz.
Related Issues (20)
- Filter by Custom Tags Question HOT 4
- Do you use Clutz? How? HOT 2
- error: cannot find symbol import com.google.javascript.rhino.jstype.FunctionType.Parameter; HOT 6
- Question: externsMap on goog standard library
- test class_extends_array.js FAILED after 20190115 HOT 2
- Fix externs: DOMRect
- [gents] arrow functions with a single argument are not emitted properly syntactically HOT 1
- clutz should emit 'unknown' when translating '*'
- enum aliases are incorrectly emitted in partial mode HOT 4
- inner classes not emitted when outer class is emitted with named export
- declare legacy namespace + export obj + enum create wrong output HOT 1
- Static members on function not emitted
- gents does not handle goog.requireType HOT 2
- gents should convert @this
- Event vs KeyboardEvent
- Closure's `goog.isDefAndNotNull` seem to affect type inference and make clutz emit extra 'any's HOT 3
- JsDoc on static enums is not preserved
- clutz should not emit 'abstract' modifier on interfaces
- sonatype.org is erring with 'too many requests' on CI HOT 8
- Build are failing HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clutz.