chrisgriffith / ionic-native-mocks

Ionic Native Mocks are designed to be used as placeholders during development for the actual Ionic Native modules.
205 stars 42 forks source link

Class 'LocalNotificationsMocks' incorrectly extends base class 'LocalNotifications' #18

Closed jburns24 closed 6 years ago

jburns24 commented 6 years ago

Cannot transpile program after adding npm i @ionic-native-mocks/local-notifications to my project.

Ill preface this issue with fact that I am new pretty new to angular and ionic. I am attempting to add unit tests to my application and needed to ad mocks for all my native plugins. I have successfully added many other ionic-native-mocks including geolocation, google-plus, and more. But when I tried to add local-notifications and run ionic cordova run android I was hit with the following transpile error

[14:29:44]  build dev started ... 
[14:29:45]  clean started ... 
[14:29:45]  clean finished in 2 ms 
[14:29:45]  copy started ... 
[14:29:45]  deeplinks started ... 
[14:29:45]  deeplinks finished in 128 ms 
[14:29:45]  transpile started ... 
[14:29:51]  typescript: node_modules/@ionic-native-mocks/local-notifications/index.d.ts, line: 81 
            Class 'LocalNotificationsMocks' incorrectly extends base class 'LocalNotifications'. Types of property 'on' 
            are incompatible. Type '(eventName: string, callback: any) => void' is not assignable to type '(eventName: 
            string) => Observable<any>'. 

      L81:  export declare class LocalNotificationsMocks extends LocalNotifications {

Error: Failed to transpile program
    at new BuildError (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at /home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
    at new Promise (<anonymous>)
    at transpileWorker (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
    at Object.transpile (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
    at /home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/build.js:109:82
    at <anonymous>
[14:29:51]  copy finished in 6.64 s 

Sorry if this is not an actual bug and I just have my environment incorrectly setup but given I have had success with the others this seemed like an issue. Not sure what other information would be helpful if but if I am missing something critical let me know and I will add it.

chrisgriffith commented 6 years ago

I will take a look. The ionic team is preparing for the new release and ionic native is getting some updates.

Chris

On Sat, Apr 28, 2018 at 2:41 PM Buster notifications@github.com wrote:

Cannot transpile program after adding npm i @ionic-native-mocks/local-notifications to my project.

Ill preface this issue with fact that I am new pretty new to angular and ionic. I am attempting to add unit tests to my application and needed to ad mocks for all my native plugins. I have successfully added many other ionic-native-mocks including geolocation, google-plus, and more. But when I tried to add local-notifications and run ionic cordova run android I was hit with the following transpile error

[14:29:44] build dev started ... [14:29:45] clean started ... [14:29:45] clean finished in 2 ms [14:29:45] copy started ... [14:29:45] deeplinks started ... [14:29:45] deeplinks finished in 128 ms [14:29:45] transpile started ... [14:29:51] typescript: node_modules/@ionic-native-mocks/local-notifications/index.d.ts, line: 81 Class 'LocalNotificationsMocks' incorrectly extends base class 'LocalNotifications'. Types of property 'on' are incompatible. Type '(eventName: string, callback: any) => void' is not assignable to type '(eventName: string) => Observable'.

  L81:  export declare class LocalNotificationsMocks extends LocalNotifications {

Error: Failed to transpile program at new BuildError (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at /home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:159:20 at new Promise () at transpileWorker (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:107:12) at Object.transpile (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:64:12) at /home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/build.js:109:82 at [14:29:51] copy finished in 6.64 s

Sorry if this is not an actual bug and I just have my environment incorrectly setup but given I have had success with the others this seemed like an issue. Not sure what other information would be helpful if but if I am missing something critical let me know and I will add it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chrisgriffith/ionic-native-mocks/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgOA-GtyakPzaH8o0Jo0mjCpOFPtiGUks5ttOH-gaJpZM4Trk2G .

chrisgriffith commented 6 years ago

Updated that mock. Update your package and see it things are resolved.

Chris

On Sat, Apr 28, 2018 at 2:43 PM Chris Griffith chris.griffith@gmail.com wrote:

I will take a look. The ionic team is preparing for the new release and ionic native is getting some updates.

Chris

On Sat, Apr 28, 2018 at 2:41 PM Buster notifications@github.com wrote:

Cannot transpile program after adding npm i @ionic-native-mocks/local-notifications to my project.

Ill preface this issue with fact that I am new pretty new to angular and ionic. I am attempting to add unit tests to my application and needed to ad mocks for all my native plugins. I have successfully added many other ionic-native-mocks including geolocation, google-plus, and more. But when I tried to add local-notifications and run ionic cordova run android I was hit with the following transpile error

[14:29:44] build dev started ... [14:29:45] clean started ... [14:29:45] clean finished in 2 ms [14:29:45] copy started ... [14:29:45] deeplinks started ... [14:29:45] deeplinks finished in 128 ms [14:29:45] transpile started ... [14:29:51] typescript: node_modules/@ionic-native-mocks/local-notifications/index.d.ts, line: 81 Class 'LocalNotificationsMocks' incorrectly extends base class 'LocalNotifications'. Types of property 'on' are incompatible. Type '(eventName: string, callback: any) => void' is not assignable to type '(eventName: string) => Observable'.

  L81:  export declare class LocalNotificationsMocks extends LocalNotifications {

Error: Failed to transpile program at new BuildError (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at /home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:159:20 at new Promise () at transpileWorker (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:107:12) at Object.transpile (/home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/transpile.js:64:12) at /home/joshua/OnTimeMe/node_modules/@ionic/app-scripts/dist/build.js:109:82 at [14:29:51] copy finished in 6.64 s

Sorry if this is not an actual bug and I just have my environment incorrectly setup but given I have had success with the others this seemed like an issue. Not sure what other information would be helpful if but if I am missing something critical let me know and I will add it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chrisgriffith/ionic-native-mocks/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgOA-GtyakPzaH8o0Jo0mjCpOFPtiGUks5ttOH-gaJpZM4Trk2G .