Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class 'Tuntap' incorrectly implements interface 'TuntapI' #16

Open
stefanwerfling opened this issue May 24, 2024 · 4 comments
Open

Class 'Tuntap' incorrectly implements interface 'TuntapI' #16

stefanwerfling opened this issue May 24, 2024 · 4 comments

Comments

@stefanwerfling
Copy link
Contributor

stefanwerfling commented May 24, 2024

With the update to the latest 18.x version of nodejs ("@types/node": "^18.19.33",) there were many new methods in the interface. Could you clarify this issue?

3.066   SOLINK_MODULE(target) Release/obj.target/tuntap2Addon.node
3.170   COPY Release/tuntap2Addon.node
3.175 make: Leaving directory '/opt/flyingfish/node_modules/tuntap2/build'
3.177 gyp info ok 
8.059 src/ts/Tuntap.ts(4,14): error TS2420: Class 'Tuntap' incorrectly implements interface 'TuntapI'.
8.059   Type 'Tuntap' is missing the following properties from type 'TuntapI': iterator, map, filter, forEach, and 10 more.

image

These come from the duplex interface:
export interface TuntapI extends Duplex

@stefanwerfling
Copy link
Contributor Author

@PupilTong Do you perhaps have a suggestion? Could you leave out "extends Duplex"? What did you think?

@PupilTong
Copy link
Owner

@PupilTong Do you perhaps have a suggestion? Could you leave out "extends Duplex"? What did you think?

Could u please inspect which interface requires these implementation? Thank!

@stefanwerfling
Copy link
Contributor Author

Hello @PupilTong,
with package.json:

"devDependencies": {
    "@types/jmespath": "^0.15.0",
    "@types/mocha": "^10.0.1",
    "@types/node": "^20.14.10",
    "coverage-badge-creator": "^1.0.18",
    "inet_xtoy": "^1.2.5",
    "mocha": "^10.2.0",
    "nyc": "^15.1.0",
    "should": "^13.2.3",
    "typescript": "^5.2.2"
  },

become:
image

....

Now i check the types:
image

The "ReadableBase" has more implemented methods. I can all implement with an Exception.

What did you think?

Next problem, i add the method:

public asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable {
        return undefined;
    }

ArrayOptions is unknow and has none export by stream.d.ts ....

It seems to me that the types are faulty. But I can't judge that because I haven't found an example that extends "Duplex".

I have now written "// @ts-ignore" at the top of the class.

@stefanwerfling
Copy link
Contributor Author

stefanwerfling commented Jul 11, 2024

With the "// @ts-ignore
export class Tuntap extends TuntapBase implements TuntapI {"

I can perform my deployment again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants