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

Property 'code' is missing in type '{ message: string; }' but required in type 'RollupWarning'. #2618

Closed
sliekens opened this issue Dec 29, 2018 · 1 comment · Fixed by #2635

Comments

@sliekens
Copy link

The TypeScript declaration for RollupWarning contains a code property that should be optional, but isn't.

  • Rollup Version: 1.0.0
  • Operating System (or Browser):
  • Node Version: 11.2.0

How Do We Reproduce?

Start developing a plugin, using TypeScript.

package.json

{
    "name": "rollup-plugin-hmm",
    "devDependencies": {
        "rollup": "^1.0.0",
        "typescript": "^3.2.2"
    },
    "scripts": {
        "start": "tsc index.ts"
    }
}

index.ts

import { Plugin } from 'rollup';

export default function(): Plugin {
    return {
        name: 'hmm',
        load(id) {
            this.warn({ message: 'hmm' });
            return null;
        }
    };
}

Now do:

$ npm start

Expected Behavior

No errors

Actual Behavior

> tsc index.ts

index.ts:7:23 - error TS2345: Argument of type '{ message: string; }' is not assignable to parameter of type 'string | RollupWarning'.
  Property 'code' is missing in type '{ message: string; }' but required in type 'RollupWarning'.

7             this.warn({ message: 'hmm' });
                        ~~~~~~~~~~~~~~~~~~

  node_modules/rollup/dist/rollup.d.ts:15:2
    15  code: string;
        ~~~~
    'code' is declared here.


Found 1 error.
@lukastaegert
Copy link
Member

Fix at #2635

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

Successfully merging a pull request may close this issue.

2 participants