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 'on' does not exist on type 'ACPController[]'. #22

Open
peiris opened this issue Oct 17, 2019 · 1 comment
Open

Property 'on' does not exist on type 'ACPController[]'. #22

peiris opened this issue Oct 17, 2019 · 1 comment

Comments

@peiris
Copy link

peiris commented Oct 17, 2019

I'm trying to integrate this with a StencilJs component. I have the below code.

componentDidLoad() {
    AColorPicker.from('.kp-color-generator__form__color-chip', {
      color: this.defaultColorHex,
      palette: 'PALETTE_MATERIAL_CHROME'
    }).on('change', (picker) => {
      this.defaultColorHex = picker.color;
    });
  }

But Stencil build fails with a warning as below, with a highlight for .on(

TypeScript: src/components/kp-color-generator/kp-color-generator.tsx:24:8
           Property 'on' does not exist on type 'ACPController[]'.

     L23:    palette: 'PALETTE_MATERIAL_CHROME'
     L24:  }).on('change', (picker) => {
     L25:    this.defaultColorHex = picker.color;
@narsenico
Copy link
Owner

Hi @peiris try to use .createPicker instead of .from.
The method .from returns an array of ACPController and for some reason Stencil doesn't recognize on/off.
Instead .createPicker returns just one ACPController instance.

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

No branches or pull requests

2 participants