ionic-team / ionic-pwa-toolkit

Build lightning fast Progressive Web Apps with zero config and best practices built-in. Go from zero to production ready with Ionic and Stencil (Web Components).
MIT License
635 stars 74 forks source link

Type keyof B #68

Closed rpersaud closed 6 years ago

rpersaud commented 6 years ago

Resources: Before submitting an issue, please consult our docs.

Stencil version: (run npm list @stencil/core from a terminal/cmd prompt and paste output below):

Roberts-MacBook-Pro:myapp robertp$ npm list @stencil/core
my-app@0.0.1 /Users/robertp/workspace/myapp
└── @stencil/core@0.9.7

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Current behavior: I get a single error when trying to build (against node v10.0.0) - npm run build

[ ERROR ]  typescript: node_modules/@ionic/core/dist/types/utils/overlays.d.ts:9:82
           Type 'keyof B' does not satisfy the constraint 'string'. Type 'string | number | symbol' is not assignable
           to type 'string'. Type 'number' is not assignable to type 'string'.

      L8:  };
      L9:  ction createOverlay<T extends HTMLIonOverlayElement & Requires<keyof B>, B>(element: T, opts: B): Promise<T>;
     L10:  export declare function dismissOverlay(data: any, role: string | undefined, overlays: OverlayMap, id: number): Promise<void>;

Expected behavior: I fixed by editing node_modules/@ionic/core/dist/types/utils/overlays.d.ts based on https://github.com/ionic-team/ionic/commit/87fe5ce3a8fa65b83d798818f96d5f01781ac3e6#diff-24fcc947660e79d1b2f094ec1b7dc3f5. I've cleaned my node_modules couple times and reinstalled to latest ionic-core, and still get the error. So the expected behavior is for this change made 18 days ago yet tags were cut 15 days ago to be in sync?

Other information:

Here's my package.json -

 "dependencies": {
    "@ionic/core": "^4.0.0-alpha.7",
    "@stencil/core": "^0.9.7",
    "firebase": "^4.13.1",
    "rxjs": "^5.5.11"
  },
  "devDependencies": {
    "@stencil/dev-server": "latest",
    "@stencil/sass": "0.0.3",
    "@stencil/utils": "latest",
    "@types/jest": "^22.2.2",
    "jest": "^22.4.4"
  },
kael commented 6 years ago

Actually the fix is https://github.com/danbucholtz/ionic/commit/2fbfd55cf07ec62767f8e1ba895786768d494cbf#diff-24fcc947660e79d1b2f094ec1b7dc3f5R13.

Have you tried with an updated package-lock.json or after having deleted package-lock.json ?

jmarceli commented 6 years ago

Hi, I have a similar issue and I've tried to delete package-lock.json but it doesn't help. To be more exact I've deleted node_modules and package-lock.json then I've run yarn install.

kael commented 6 years ago

For Yarn I can't help. But I've been able to downgrade to the previous version after having deleted the both resources you mention.

jmarceli commented 6 years ago

What packages did you downgrade?

marufdolani commented 6 years ago

i could never get it to work. dropped it for now and just used https://github.com/madskristensen/WebEssentials.AspNetCore.ServiceWorker for my PWA for now.

kael commented 6 years ago

@jmarceli I reverted https://github.com/ionic-team/ionic-pwa-toolkit/commit/d380e583ff9124125c1620a819a63d89b3b4c5b2#diff-b9cfc7f2cdf78a7f4b91a753d10865a2L19

jmarceli commented 6 years ago

Thanks for the reply. I've found that instead of a downgrade it is enough to open node_modules/@ionic/core/dist/types/utils/overlays.d.ts and change:

export declare function createOverlay<T extends HTMLIonOverlayElement & Requires<keyof B>, B>(element: T, opts: B): Promise<T>;

to:

export declare function createOverlay<T extends HTMLIonOverlayElement & Requires<string>, B>(element: T, opts: B): Promise<T>;

(like in the fork with fix that you mention earlier). That is not an ideal way of solving this issue (definitely not future-proof), but it seems to be fine till there will be an "official fix".

jgw96 commented 6 years ago

Hello all! This is an issue with @ionic/core@4.0.0-alpha.7 that has already been fixed and will be in the next release. For now I am going to downgrade this to use the alpha.6 release. Thanks for using Ionic!

joewoodhouse commented 6 years ago

This issue is present in the alpha.6 isn't it? I'm still getting it https://github.com/ionic-team/ionic/blob/v4.0.0-alpha.6/core/src/utils/overlays.ts

cyraid commented 6 years ago

I'm getting this. Was hoping to give it a run, but this is a showstopper.