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

TS2430: Interface 'Dockerfile' incorrectly extends interface 'ImageTemplate' #46

Closed
robcresswell opened this issue Nov 14, 2018 · 12 comments
Assignees

Comments

@robcresswell
Copy link

Running tsc seems to cause build errors when consuming the library.

node_modules/dockerfile-ast/lib/main.d.ts:30:18 - error TS2430: Interface 'Dockerfile' incorrectly extends interface 'ImageTemplate'.
  Types of property 'resolveVariable' are incompatible.
    Type '(variable: string, line: number) => string | null | undefined' is not assignable to type '(variable: string, line: number) => string'.
      Type 'string | null | undefined' is not assignable to type 'string'.
        Type 'undefined' is not assignable to type 'string'.
@rcjsuen
Copy link
Owner

rcjsuen commented Nov 14, 2018

@robcresswell Thank you for your bug report. Which version of TypeScript are you on?

@robcresswell
Copy link
Author

I tried several: 3.1.6, 2.9.2, 2.8.4

@robcresswell
Copy link
Author

If I can help out further, I'd love to; this lib looks excellent so far.

@rcjsuen
Copy link
Owner

rcjsuen commented Nov 14, 2018

@robcresswell I'm pretty sure I know what the problem is. However, I'm unable to reproduce the problem. I removed my package-lock.json file and changed my package.json to point to your versions but did not get a compiler error while building the library or running npm test.

"typescript": "~2.6.1",

Perhaps my tsconfig.json file is not strict enough?

@rcjsuen
Copy link
Owner

rcjsuen commented Nov 14, 2018

Never mind, using "strict": true did the trick. :)

@robcresswell
Copy link
Author

Ah! Nice debugging. I was trying things locally to try and get some more concrete info before I got back to you. How should we proceed from here? Would you be willing to adopt a stricter tsconfig, or would you prefer me to relax mine?

rcjsuen added a commit that referenced this issue Nov 14, 2018
Signed-off-by: Remy Suen <remy.suen@gmail.com>
@rcjsuen rcjsuen self-assigned this Nov 14, 2018
@rcjsuen
Copy link
Owner

rcjsuen commented Nov 14, 2018

@robcresswell Thank you for your bug report. I have fixed this in `master. You can review the fix by looking at 7073209 if you wish.

To get around this for yourself in the immediate future, you can turn on skipLibCheck so that the TypeScript compiler doesn't try to check your dependent libraries.

@robcresswell
Copy link
Author

That's awesome. Thanks for your help; any plans for an upcoming release?

@rcjsuen
Copy link
Owner

rcjsuen commented Nov 14, 2018

@robcresswell Not at the moment.

I think what I'd like to do is turn on strict and try to correct what it finds and then maybe cut a new release then. How does that sound to you?

@robcresswell
Copy link
Author

Sounds great; if you'd like some help, please let me know. I know asking for changes in OSS can be a massive pain, so I don't want to demand your time by any means.

@rcjsuen
Copy link
Owner

rcjsuen commented Nov 14, 2018

@robcresswell No worries. You've already helped out by opening a bug. You're the first person to open a bug in this project. The other 45 before you were all opened by me! :)

If you have any suggestions, find something is unclear, or find another bug, let me know! The parsing of quoted strings, JSON, and ARG and ENV instructions are probably the most confusing but I imagine you won't be hitting those strange edge cases hopefully...

@rcjsuen rcjsuen changed the title TSC Error TS2430: Interface 'Dockerfile' incorrectly extends interface 'ImageTemplate' Nov 14, 2018
@rcjsuen
Copy link
Owner

rcjsuen commented Dec 20, 2018

Hi, @robcresswell. I just published a new version of dockerfile-ast to npm. I did not fix all of the null cases though so you may still need that skipLibCheck in your tsconfig.json file.

Thank you for your patience and understanding!

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

No branches or pull requests

2 participants