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

BUG: TS2416: Property '_up' in type 'PropertyStack' is not assignable to the same property in base type 'PropertyComposite<PropertyStackProps>' #5154

Closed
2 tasks done
jmtt89 opened this issue May 31, 2023 · 7 comments

Comments

@jmtt89
Copy link

jmtt89 commented May 31, 2023

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?


Reproducible demo link

https://codesandbox.io/p/sandbox/pensive-browser-mfhxp8

Describe the bug

How to reproduce the bug?

  1. Create Angular Project
  2. Add grapeJS dependency
  3. include "allowSyntheticDefaultImports": true on tsconfig (for backbone)
  4. Create wrapper component for GrapeJS
import { Component, OnInit } from '@angular/core';
import grapesjs from 'grapesjs';

@Component({
  selector: 'app-editor',
  template: '<div id="myComposer"></div>',
  styleUrls: ['./editor.component.css'],
})
export class EditorComponent implements OnInit {
  constructor() {}

  ngOnInit(): void {
    this.loadGrapesJS();
  }

  private loadGrapesJS() {
    console.log('loadGrapesJS');
    grapesjs.init({
      container: '#myComposer',
    });
  }
}
  1. Use the wrapper component on the project
<app-editor></app-editor>

What is the expected behavior?

Render GrapeJS Editor

What is the current behavior?

Broken on Build

Build at: 2023-05-31T14:41:40.309Z - Hash: dc2896192a7f20df - Time: 11178ms

Warning: /workspace/src/app/editor/editor.component.ts depends on 'grapesjs'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies



Error: node_modules/grapesjs/dist/index.d.ts:7601:2 - error TS2416: Property '_up' in type 'PropertyStack' is not assignable to the same property in base type 'PropertyComposite<PropertyStackProps>'.
  Type '(props: Partial<PropertyStackProps>, opts?: OptionsUpdate | undefined) => this' is not assignable to type '(props: Partial<PropertyCompositeProps>, opts?: OptionsUpdate | undefined) => this'.
    Types of parameters 'props' and 'props' are incompatible.
      Type 'Partial<PropertyCompositeProps>' is not assignable to type 'Partial<PropertyStackProps>'.
        Types of property 'fromStyle' are incompatible.
          Type 'FromStyle | undefined' is not assignable to type '((style: StyleProps, data: FromStyleDataStack) => PropValues) | undefined'.

7601  _up(props: Partial<PropertyStackProps>, opts?: OptionsUpdate): this;
      ~~~

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sfreed
Copy link

sfreed commented Jun 3, 2023

Getting Same Error

@Deepakanandrao
Copy link

+1

1 similar comment
@marktamis
Copy link

+1

@marktamis
Copy link

marktamis commented Jun 8, 2023

I copied over some of the settings of the tsconfig from a working vite gjs project into my stenciljs project and now it is running correctly. I think you need to do some tweaking to your angular tsconfig and it should not throw the error anymore

below is my working stenciljs tsconfig:

{
  "compilerOptions": {
    "forceConsistentCasingInFileNames": true,
    "allowSyntheticDefaultImports": true,
    "allowUnreachableCode": false,
    "declaration": false,
    "experimentalDecorators": true,
    "lib": ["dom", "es2021", "DOM.Iterable"],
    "skipLibCheck": true,
    "strictNullChecks": false,
    "moduleResolution": "nodenext",
    "module": "esnext",
    "target": "es2021",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "jsx": "react",
    "jsxFactory": "h"
  },
  "include": [
    "src"
  ],
  "exclude": [
      "node_modules"
  ]
}
    "skipLibCheck": true,
    "strictNullChecks": false,

seems to be what allows the compilation

@Deepakanandrao
Copy link

"skipLibCheck": true,

"skipLibCheck": true did the trick. Thank you @marktamis 👍

@artf
Copy link
Member

artf commented Jun 15, 2023

Yeah "skipLibCheck": true is necessary here until I find the fix for that TS output 😞

@artf artf closed this as completed in 6db8fe2 Jun 15, 2023
@jmtt89
Copy link
Author

jmtt89 commented Jun 15, 2023

Thanks!!!

artf added a commit that referenced this issue Jul 4, 2023
* Add autoFormat option to CodeMirrorEditor

* Add optsCodeViewer

* Remove unused options

* Use createViewer in ExportTemplate

* Up ExportTemplate

* Cleanup

* Up panel/index to TS

* Refactor Panels TS #5144

* Cleanup

* Up panels test

* Fix `usePlugin is not a function`. Closes #5167

* Move css_composer/index to TS

* Up css_composer tests

* Up tests

* Add `addStyles` option to `editor.Css.setRule`. Closes #5173

* Update setRule JSDoc

* Fix PropertyStack in bundled dts file. Closes #5154

* Fixed broken link in README.md (#5188)

Update README.md

added ".com" in a not functioning link.

* Refactor Traits Collection (#4983)

* Refactor Traits Collection

* Fix css prefix

* Fix trait undo and add test for it

---------

Co-authored-by: Artur Arseniev <[email protected]>

* Update keymaps add jsdoc

* Improve typings (#5192)

* add component:resize to ComponentEvent type

* limit storageManager type to be 'local' | 'remote' | undefined

* add type to components parameter

* Use LiteralUnion in storage_manager config

* Up editor TS

* Improve components TS

* Update ComponentModelDefinition

* [Docs] Update Broken Links for (Component Types, and Commands) (#5196)

update links

* Don't remove styles with avoidInlineStyle #4503

* Up block_manager

* Up device_manager

* Up pages TS

* Add PageProperties

* Update PageManager TS

* Export Sector/s in TS

* Up style_manager TS

* Up Property TS

* Up TS

* Up TS

* Up canvas class

* Fix SwitchVisibility

* Store custom selector manager container

* Refactor OpenStyleManager

* Up OpenStyleManager

* Up OpenStyleManager

* Up selector_manager

* Add custom option to trait_manager

* Up trait model

* Up OpenTraitManager for custom traits

* Up

* Handle properly Component model `defaults` as functions. Closes #5199

* Fix PropertyFactory tests

* Up RTE doc

* Update rich_text_editor.md (#5201)

The previous code snippet encountered a syntax error when attempting to use it in my application. To ensure its usability for others, I have made necessary updates to resolve the syntax error and enable successful execution. These modifications aim to provide a code snippet that can be easily utilized by anyone without encountering any syntax-related issues.

* Build

* Up docs

---------

Co-authored-by: pfaffmann <[email protected]>
Co-authored-by: Alex Ritter <[email protected]>
Co-authored-by: Julia Alberici <[email protected]>
Co-authored-by: Abdelrhman Said <[email protected]>
Co-authored-by: Ai Anshu <[email protected]>
pety-dc pushed a commit to d-code-ltd/grapesjs that referenced this issue Aug 14, 2023
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

5 participants