Rollup build error that does not make sense

I am getting this error:

Error: Module /Users/michael/Repos/covve.Ionic2/src/userprofile/models/user-profile.model.ts does not export IImmutableUserProfile (imported by /Users/michael/Repos/covve.Ionic2/src/userprofile/components/user-profile-editor/user-profile-editor.component.ts

But in user-profile.model.ts I have the below code:

import Immutable from 'immutable';
import { IProfile, Profile } from '../../shared/models/profile.model';

export interface IImmutableUserProfile extends Immutable.Map<string,any> {
  toJS():IUserProfile;
}

export interface IUserProfile extends IProfile {
  tags?:string[];
}

export class UserProfile extends Profile implements IUserProfile {
  public tags:string[];

  constructor(data?:IUserProfile) {
    super(data);
    data = data || { _id: undefined };
    this._id = this._id || 'profile';
    this.tags = data.tags || [];
  }

  toJSON():IUserProfile {
    let obj:IUserProfile = super.toJSON();
    obj.tags = this.tags;
    return obj;
  }

  toImmutable():IImmutableUserProfile {
    return Immutable.fromJS(this.toJSON());
  }
}

I am clearly exporting all the interfaces. What is going on that I fail to understand?

I had that error yesterday.

Believe its related to how the app is configured to build (tsconfig), and it tries to compile stuff that has already been compiled (like generated d.ts files).

Solved mine by setting outDir to “dist/” and then having the npm task that builds first remove that directory beforehand:
“build”: "rm -rf dist && … ".

The “three shaken file” I’ve placed in dist/bundles/build.js.

Hope thats clear enough

Thanks for the info. Unfortunately I cannot get it to work.
Did you just define a outDir in tsconfig.json? Because for me it has no effect.
I also tried setting declaration to false, but still no joy.

You can just have my tsconfig:

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "declaration": true,
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "dist/"
  },
  "filesGlob": [
    "index.ts",
    "src/**/*.ts",
    "!node_modules/**/*"
  ],
  "angularCompilerOptions": {
    "genDir": "src/ngfactory"
  }
}

You can probably ignore the angularCompilerOptions, since thats related to AoT compiling, which pretty much everyone are confused about atm.

My folder structure is:
root
L src/
L … the rest …
L index.ts that simply imports everything from src/*

Ps.
Remember to add the main field in package.json: “main”: “dist/index.js”

I have the same error using nodejs 6.x, changed to nodejs 5.x and works correctly.