Giter Club home page Giter Club logo

Comments (4)

alexeagle avatar alexeagle commented on July 19, 2024

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.

mprobst avatar mprobst commented on July 19, 2024

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.

rkirov avatar rkirov commented on July 19, 2024

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.

alexeagle avatar alexeagle commented on July 19, 2024

+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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.