Skip to content

Update ts_library_builder to properly handle global types #1854

@bartlomieju

Description

@bartlomieju

Creating separate issue so it's not forgotten.

As this stands at the moment, it won't flow through to the runtime type library. (If you do deno --types you will see it is missing).

The interface is already a global interface (interface ImportMeta {}) as it has been reserved in the language for a long time. We need to extend this interface in the global scope, which is what happens when it is located in lib.web_assembly.d.ts file as that is simply inlined in the runtime type library, but that isn't the "right" way to do it for extending this in the long term. I think it is better that we put this directly in the globals.ts, the only problem is that we need to change ts_library_builder in the mergeGlobal function to copy over any interfaces there into the type library.

That is a bit complicated, so if you wanted to, just move it back to the web assembly library, and then I can do a follow up PR making the change to ts_library_builder. Otherwise you can try to tackle it. It should be added somewhere around here and needs to be done is iterate over any interfaces, ensuring it weeds out the special global interface and adds those to the target.

Originally posted by @kitsonk in #1835 (comment)

I'll tackle that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions