haxiomic / dts2hx

Converts TypeScript definition files (d.ts) to haxe externs (.hx) via the TypeScript compiler API
MIT License
134 stars 9 forks source link

Autocompletion is broken with firebase-admin lib #37

Closed posxposy closed 4 years ago

posxposy commented 4 years ago

Hi! I'm not sure if I should create this kind of issue in dts2hx repo... but autocompletion is broken when I'm trying to use externs generated by dts2hx for firebase-admin lib :) Example:

        final app = Firebase_admin.initializeApp(); //returns firebase_admin.app.App
        app. //but nothing here :(

image

VSCode output:

[Error - 8:04:19 PM] Request textDocument/hover failed.
  Message: Error: No completion point was found
  Code: -32603 

My package.json is:

    "dependencies": {
        "firebase-admin": "^8.12.1"
    },
    "devDependencies": {
        "dts2hx": "^0.12.3",
    }

Thanks!

haxiomic commented 4 years ago

Hey, thanks for testing, I can reproduce: seems like some types are missing from conversion which causes a compiler error

Will investigate!

haxiomic commented 4 years ago

Found the issue, i've added a new flag --includeExternal which resolves it.

It's a short term workaround because the issue will be resolved fully as part of some rearchitecting I plan to do soon (after which the flag will not be required)

For my own future reference: This is caused when the main module uses a symbol from a dependency, but when later converting the dependency, that symbol is not linked from the root typings so it never gets generated

Two solutions: