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]: Compiler errors when using fabric.js 6.4.3 with Angular 16.2.6 #10196

Open
7 tasks done
schtucks opened this issue Oct 7, 2024 · 28 comments
Open
7 tasks done

[Bug]: Compiler errors when using fabric.js 6.4.3 with Angular 16.2.6 #10196

schtucks opened this issue Oct 7, 2024 · 28 comments

Comments

@schtucks
Copy link

schtucks commented Oct 7, 2024

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have read and followed the Issue Tracker Guide
  • I have searched and referenced existing issues and discussions
  • I am filing a BUG report.
  • I have managed to reproduce the bug after upgrading to the latest version
  • I have created an accurate and minimal reproduction

Version

6.4.3

Node Version (if applicable)

18.20.3

Link To Reproduction

https://stackblitz.com/edit/node-rjvbk2?file=src%2Fapp%2Fapp.component.ts

Steps To Reproduce

  1. Create a new Angular 16.2.6 project
  2. Install fabric.js 6.4.3 (npm install [email protected])
  3. Import fabric.js in the project
  4. Run ng serve

Expected Behavior

The project should compile and serve without errors.

Actual Behavior

Multiple compiler errors occur, preventing the project from compiling successfully.

Error Message & Stack Trace

The errors seem to be related to TypeScript declarations within fabric.js itself, suggesting potential incompatibilities with TypeScript 4.9.5 which i used in this project.

When running ng serve, the following terminal output appears:

ng serve
Workspace extension with invalid name (defaultProject) found.
⠋ Generating browser application bundles (phase: setup)...    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browerslist configuration. For more information, see https://angular.io/guide/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
✔ Browser application bundle generation complete.

Initial Chunk Files   | Names         |  Raw Size
vendor.js             | vendor        |   2.44 MB | 
polyfills.js          | polyfills     | 335.30 kB | 
styles.css, styles.js | styles        | 229.35 kB | 
runtime.js            | runtime       |   6.52 kB | 
main.js               | main          |   6.31 kB | 

                      | Initial Total |   3.00 MB

Build at: 2024-10-07T08:14:49.305Z - Hash: ea7c5ff67b41a077 - Time: 3876ms

Error: node_modules/fabric/dist/fabric.d.ts:34:1 - error TS1383: Only named exports may use 'export type'.

34 export type * from './src/util/path/typedefs';
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/fabric/dist/src/env/index.d.ts:9:32 - error TS7016: Could not find a declaration file for module 'jsdom'. '/home/projects/node-sf3daf/node_modules/fabric/node_modules/jsdom/lib/api.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/jsdom` if it exists or add a new declaration (.d.ts) file containing `declare module 'jsdom';`

9 import type { DOMWindow } from 'jsdom';
                                 ~~~~~~~


Error: node_modules/fabric/dist/src/env/types.d.ts:2:32 - error TS7016: Could not find a declaration file for module 'jsdom'. '/home/projects/node-sf3daf/node_modules/fabric/node_modules/jsdom/lib/api.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/jsdom` if it exists or add a new declaration (.d.ts) file containing `declare module 'jsdom';`

2 import type { DOMWindow } from 'jsdom';
                                 ~~~~~~~


Error: node_modules/fabric/dist/src/filters/Composed.d.ts:29:5 - error TS2416: Property 'toObject' in type 'Composed' is not assignable to the same property in base type 'BaseFilter<"Composed", ComposedOwnProps>'.
  Type '() => { type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type '() => { type: "Composed"; } & ComposedOwnProps'.
    Type '{ type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type '{ type: "Composed"; } & ComposedOwnProps'.
      Type '{ type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type 'ComposedOwnProps'.
        Types of property 'subFilters' are incompatible.
          Type '({ type: string; } & object)[]' is not assignable to type 'BaseFilter<string, object>[]'.
            Type '{ type: string; }' is missing the following properties from type 'BaseFilter<string, object>': getFragmentSource, getVertexSource, createProgram, getAttributeLocations, and 16 more.

29     toObject(): {
       ~~~~~~~~


Error: node_modules/fabric/dist/src/filters/HueRotation.d.ts:26:5 - error TS2416: Property 'toObject' in type 'HueRotation' is not assignable to the same property in base type 'ColorMatrix<"HueRotation", HueRotationOwnProps>'.
  Type '() => { type: "HueRotation"; rotation: number; }' is not assignable to type '() => { type: "HueRotation"; } & HueRotationOwnProps & { matrix: TMatColorMatrix; }'.
    Type '{ type: "HueRotation"; rotation: number; }' is not assignable to type '{ type: "HueRotation"; } & HueRotationOwnProps & { matrix: TMatColorMatrix; }'.
      Property 'matrix' is missing in type '{ type: "HueRotation"; rotation: number; }' but required in type '{ matrix: TMatColorMatrix; }'.

26     toObject(): {
       ~~~~~~~~

  node_modules/fabric/dist/src/filters/ColorMatrix.d.ts:62:9
    62         matrix: TMatColorMatrix;
               ~~~~~~
    'matrix' is declared here.


Error: node_modules/fabric/dist/src/shapes/Textbox.d.ts:223:5 - error TS2416: Property 'toObject' in type 'Textbox<Props, SProps, EventSpec>' is not assignable to the same property in base type 'IText<Props, SProps, EventSpec>'.
  Type '<T extends Omit<Props & import("/home/projects/node-sf3daf/node_modules/fabric/dist/src/typedefs").TClassProperties<this>, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[] | undefined) => Pick<...> & SProps' is not assignable to type '<T extends Omit<Props & import("/home/projects/node-sf3daf/node_modules/fabric/dist/src/typedefs").TClassProperties<this>, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[] | undefined) => Pick<...> & SProps'. Two different types with this name exist, but they are unrelated.
    Types of parameters 'propertiesToInclude' and 'propertiesToInclude' are incompatible.
      Type 'K[] | undefined' is not assignable to type '(Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>)[] | undefined'.
        Type 'K[]' is not assignable to type '(Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>)[]'.
          Type 'K' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.
            Type 'keyof T' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.
              Type 'string | number | symbol' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.
                Type 'string' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.

223     toObject<T extends Omit<Props & TClassProperties<this>, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[]): Pick<T, K> & SProps;
        ~~~~~~~~




** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **


✖ Failed to compile.
✔ Browser application bundle generation complete.

5 unchanged chunks

Build at: 2024-10-07T08:14:49.551Z - Hash: ea7c5ff67b41a077 - Time: 158ms

Error: node_modules/fabric/dist/fabric.d.ts:34:1 - error TS1383: Only named exports may use 'export type'.

34 export type * from './src/util/path/typedefs';
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/fabric/dist/src/env/index.d.ts:9:32 - error TS7016: Could not find a declaration file for module 'jsdom'. '/home/projects/node-sf3daf/node_modules/fabric/node_modules/jsdom/lib/api.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/jsdom` if it exists or add a new declaration (.d.ts) file containing `declare module 'jsdom';`

9 import type { DOMWindow } from 'jsdom';
                                 ~~~~~~~


Error: node_modules/fabric/dist/src/env/types.d.ts:2:32 - error TS7016: Could not find a declaration file for module 'jsdom'. '/home/projects/node-sf3daf/node_modules/fabric/node_modules/jsdom/lib/api.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/jsdom` if it exists or add a new declaration (.d.ts) file containing `declare module 'jsdom';`

2 import type { DOMWindow } from 'jsdom';
                                 ~~~~~~~


Error: node_modules/fabric/dist/src/filters/Composed.d.ts:29:5 - error TS2416: Property 'toObject' in type 'Composed' is not assignable to the same property in base type 'BaseFilter<"Composed", ComposedOwnProps>'.
  Type '() => { type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type '() => { type: "Composed"; } & ComposedOwnProps'.
    Type '{ type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type '{ type: "Composed"; } & ComposedOwnProps'.
      Type '{ type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type 'ComposedOwnProps'.
        Types of property 'subFilters' are incompatible.
          Type '({ type: string; } & object)[]' is not assignable to type 'BaseFilter<string, object>[]'.
            Type '{ type: string; }' is missing the following properties from type 'BaseFilter<string, object>': getFragmentSource, getVertexSource, createProgram, getAttributeLocations, and 16 more.

29     toObject(): {
       ~~~~~~~~


Error: node_modules/fabric/dist/src/filters/HueRotation.d.ts:26:5 - error TS2416: Property 'toObject' in type 'HueRotation' is not assignable to the same property in base type 'ColorMatrix<"HueRotation", HueRotationOwnProps>'.
  Type '() => { type: "HueRotation"; rotation: number; }' is not assignable to type '() => { type: "HueRotation"; } & HueRotationOwnProps & { matrix: TMatColorMatrix; }'.
    Type '{ type: "HueRotation"; rotation: number; }' is not assignable to type '{ type: "HueRotation"; } & HueRotationOwnProps & { matrix: TMatColorMatrix; }'.
      Property 'matrix' is missing in type '{ type: "HueRotation"; rotation: number; }' but required in type '{ matrix: TMatColorMatrix; }'.

26     toObject(): {
       ~~~~~~~~

  node_modules/fabric/dist/src/filters/ColorMatrix.d.ts:62:9
    62         matrix: TMatColorMatrix;
               ~~~~~~
    'matrix' is declared here.


Error: node_modules/fabric/dist/src/shapes/Textbox.d.ts:223:5 - error TS2416: Property 'toObject' in type 'Textbox<Props, SProps, EventSpec>' is not assignable to the same property in base type 'IText<Props, SProps, EventSpec>'.
  Type '<T extends Omit<Props & import("/home/projects/node-sf3daf/node_modules/fabric/dist/src/typedefs").TClassProperties<this>, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[] | undefined) => Pick<...> & SProps' is not assignable to type '<T extends Omit<Props & import("/home/projects/node-sf3daf/node_modules/fabric/dist/src/typedefs").TClassProperties<this>, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[] | undefined) => Pick<...> & SProps'. Two different types with this name exist, but they are unrelated.
    Types of parameters 'propertiesToInclude' and 'propertiesToInclude' are incompatible.
      Type 'K[] | undefined' is not assignable to type '(Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>)[] | undefined'.
        Type 'K[]' is not assignable to type '(Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>)[]'.
          Type 'K' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.
            Type 'keyof T' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.
              Type 'string | number | symbol' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.
                Type 'string' is not assignable to type 'Exclude<TNonFunctionPropertyNames<this>, keyof SProps> | Exclude<keyof Props, keyof SProps>'.

223     toObject<T extends Omit<Props & TClassProperties<this>, keyof SProps>, K extends keyof T = never>(propertiesToInclude?: K[]): Pick<T, K> & SProps;
        ~~~~~~~~

✖ Failed to compile.
@asturur
Copy link
Member

asturur commented Oct 7, 2024

fabric uses typescript 5.5.4 so far.
for the JSDOM errors please either install jsdom types or avoid importing fabric in files that need to run under node.

@sprengerst
Copy link

I tried with 5.5.4

still the same also for me @asturur

Error: node_modules/fabric/dist/src/filters/Composed.d.ts:29:5 - error TS2416: Property 'toObject' in type 'Composed' is not assignable to the same property in base type 'BaseFilter<"Composed", ComposedOwnProps>'.
Type '() => { type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type '() => { type: "Composed"; } & ComposedOwnProps'.
Type '{ type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type '{ type: "Composed"; } & ComposedOwnProps'.
Type '{ type: "Composed"; subFilters: ({ type: string; } & object)[]; }' is not assignable to type 'ComposedOwnProps'.
Types of property 'subFilters' are incompatible.
Type '({ type: string; } & object)[]' is not assignable to type 'BaseFilter<string, object>[]'.
Type '{ type: string; }' is missing the following properties from type 'BaseFilter<string, object>': getFragmentSource, getVertexSource, createProgram, getAttributeLocations, and 16 more.

29 toObject(): {
~~~~~~~~

Error: node_modules/fabric/dist/src/filters/HueRotation.d.ts:26:5 - error TS2416: Property 'toObject' in type 'HueRotation' is not assignable to the same property in base type 'ColorMatrix<"HueRotation", HueRotationOwnProps>'.
Type '() => { type: "HueRotation"; rotation: number; }' is not assignable to type '() => { type: "HueRotation"; } & HueRotationOwnProps & { matrix: TMatColorMatrix; }'.
Type '{ type: "HueRotation"; rotation: number; }' is not assignable to type '{ type: "HueRotation"; } & HueRotationOwnProps & { matrix: TMatColorMatrix; }'.
Property 'matrix' is missing in type '{ type: "HueRotation"; rotation: number; }' but required in type '{ matrix: TMatColorMatrix; }'.

26 toObject(): {
~~~~~~~~

node_modules/fabric/dist/src/filters/ColorMatrix.d.ts:62:9
62 matrix: TMatColorMatrix;
~~~~~~
'matrix' is declared here.

** Angular Live Development Server is listening on localhost:4401, open your browser on http://localhost:4401/ **

× Failed to compile.

@asturur
Copy link
Member

asturur commented Oct 25, 2024

But why those errors would not show up when building fabricJS itself?

@Vermilion755
Copy link

I am also getting the same errors with Angular 18.1.2 and Node 20.18.0. I tried installing typescript 5.5.4 and still no dice. I get the same errors as posted above.

@Smrtnyk
Copy link

Smrtnyk commented Nov 8, 2024

have you tried skipLibCheck compiler option?

@asturur
Copy link
Member

asturur commented Nov 9, 2024

I still have this question tho,

But why those errors would not show up when building fabricJS itself?

@Smrtnyk
Copy link

Smrtnyk commented Nov 9, 2024

my hunch is that they installed some packages and they augment some interfaces and then they get conflicts
also maybe they are having a shared tsconfig that pulls in both jsdom and node types but they are building for browser.
Probably a project setup issues, but anyway they should turn it off with skipLibCheck
I so far had no issues with fabric and typescript and am using fabric 6 for quite some time now

@Vermilion755
Copy link

Yes, it compiles for me with skipLibCheck: true, but I can't find anyway to turn on skipLibCheck ONLY for Fabric, so it's not a real solution here.

@Smrtnyk
Copy link

Smrtnyk commented Nov 11, 2024

I see fabric also has the skipLibCheck: true in its own tsconfig
also they have https://github.com/fabricjs/fabric.js/blob/master/tsconfig.json#L68
noEmitOnError set to false, which I find weird
that means if fabric builds with typescript errors it will not fail the build allowing broken types to pass through

@Andjelko20
Copy link

Andjelko20 commented Dec 2, 2024

Did someone find a solution, i'm having the same problem with version 6.0.0.
Angular CLI 16.1.0 and Node Version 18.14.2 and Typescript version 5.1.3.
Need quick answer

@asturur
Copy link
Member

asturur commented Dec 3, 2024

So i wonder if those errors are muted on our side and the build process strips the muting comments?

@asturur
Copy link
Member

asturur commented Dec 3, 2024

I see fabric also has the skipLibCheck: true in its own tsconfig also they have https://github.com/fabricjs/fabric.js/blob/master/tsconfig.json#L68 noEmitOnError set to false, which I find weird that means if fabric builds with typescript errors it will not fail the build allowing broken types to pass through

FabricJS can't build with errors. If you introduce a TS error the build process will exit. I think that is take care by rollup.

@Smrtnyk
Copy link

Smrtnyk commented Dec 3, 2024

FabricJS can't build with errors. If you introduce a TS error the build process will exit. I think that is take care by rollup.

I see, I am not familiar with rollup build and rollup doing the typecheck on ts codebase
I was just questioning the reason of the noEmitOnError flag being set to false

@Andjelko20
Copy link

I've manage to update the angular version to 17.3.11 and typescript 5.4.5 but still no results...

@Smrtnyk
Copy link

Smrtnyk commented Dec 3, 2024

I've manage to update the angular version to 17.3.11 and typescript 5.4.5 but still no results...

If it is critical for you try adding skipLibCheck: true in your tsconfig

@asturur
Copy link
Member

asturur commented Dec 3, 2024

I m removing those commented options from the config:
#10308

It has nothing to do with this issue but i think it was wroth pointing it out.

For those errors:

  /**
   * Serialize this filter into JSON.
   * @returns {Object} A JSON representation of this filter.
   */
  //@ts-expect-error TS doesn't like this toObject
  toObject(): {
    type: 'Composed';
    subFilters: ReturnType<BaseFilter<string, object>['toObject']>[];
  } {
    return {
      type: this.type,
      subFilters: this.subFilters.map((filter) => filter.toObject()),
    };
  }

as you see we have an expect error here, and rollup removing comments is also removing those ts-expect-error.
We need to configure rollup to do not delete those if possible

we have 3 expect error in the code

image

To have it working correctly i think we need to introduce the serializedProps in the base filter definition

@asturur
Copy link
Member

asturur commented Dec 3, 2024

Not sure how long will take #10309

@asturur
Copy link
Member

asturur commented Dec 6, 2024

Please check if 6.5.3 improves the situation or not

@Smrtnyk
Copy link

Smrtnyk commented Dec 9, 2024

@asturur I tried the latest fabric and there are still type issues with imports from jsdom although nowhere in my app I use jsdom
I use fabric purely in browser environment
It seems like it wants me to install jsdom and jsdom types

@asturur
Copy link
Member

asturur commented Dec 12, 2024

So did something change or is identical as before?
it shouldn't ask you to install JSDOM if you are not using the node imports.

If the only left warning is to install JSDOM types just install those. Those should be types only and shouldn't finish in your bundle at all

@Smrtnyk
Copy link

Smrtnyk commented Dec 22, 2024

@asturur it reduced
now there are only 3 type issues left ( 2 of them because of jsdom )

../../node_modules/.pnpm/[email protected][email protected]/node_modules/fabric/dist/src/env/index.d.ts:9:32 - error TS7016: Could not find a declaration file for module 'jsdom'. '/home/milankeser/projects/Firetable/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/jsdom/lib/api.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/jsdom` if it exists or add a new declaration (.d.ts) file containing `declare module 'jsdom';`

9 import type { DOMWindow } from 'jsdom';
                                 ~~~~~~~

../../node_modules/.pnpm/[email protected][email protected]/node_modules/fabric/dist/src/env/types.d.ts:2:32 - error TS7016: Could not find a declaration file for module 'jsdom'. '/home/milankeser/projects/Firetable/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/jsdom/lib/api.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/jsdom` if it exists or add a new declaration (.d.ts) file containing `declare module 'jsdom';`

2 import type { DOMWindow } from 'jsdom';
                                 ~~~~~~~

../../node_modules/.pnpm/[email protected][email protected]/node_modules/fabric/dist/src/shapes/Path.d.ts:138:110 - error TS2344: Type '{ left: undefined; top: undefined; noScaleCache: boolean; hoverCursor: string | null; moveCursor: string | null; selectionBackgroundColor: string; perPixelTargetFind: boolean; selectable: boolean; ... 64 more ...; path: TSimplePathData; }' does not satisfy the constraint 'TOptions<PathProps>'.
  Type '{ left: undefined; top: undefined; noScaleCache: boolean; hoverCursor: string | null; moveCursor: string | null; selectionBackgroundColor: string; perPixelTargetFind: boolean; selectable: boolean; ... 64 more ...; path: TSimplePathData; }' is not assignable to type 'Partial<PathProps>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
    Types of property 'left' are incompatible.
      Type 'undefined' is not assignable to type 'number'.

138     static fromElement(element: HTMLElement, options: Partial<PathProps>, cssRules?: CSSRules): Promise<Path<{
                                                                                                                 ~
139         left: undefined;
    ~~~~~~~~~~~~~~~~~~~~~~~~
... 
211         path: TSimplePathData;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212     }, SerializedPathProps, ObjectEvents>>;
    ~~~~~


Found 3 errors.

and the 3rd one is only because I have "exactOptionalPropertyTypes": true, in my tsconfig, without it issue goes away

If you need a repro you can test it out here
https://github.com/Smrtnyk/Firetable/tree/master/packages/floor-creator
but I believe it would happen in any repo that has "exactOptionalPropertyTypes": true, in the tsconfig

regarding jsdom types, I am using skipLibCheck option so this whole issue is not an issue for me and I don't need to install jsdom then

@asturur
Copy link
Member

asturur commented Dec 22, 2024

Maybe we can add in the docs about installing the jsdom types, and we can look into this exactOptional thing

@Smrtnyk
Copy link

Smrtnyk commented Dec 27, 2024

I think in order to fix that one issue we would need to change the
https://github.com/fabricjs/fabric.js/blob/master/src/shapes/Object/types/BaseProps.ts#L11
to have
top and left both declared as number | undefined
because in this place
https://github.com/fabricjs/fabric.js/blob/master/src/shapes/Path.ts#L412
you pass undefined for both of them

I cloned the repo and tried to build it and see if I can contribute the fix
but It is not clear to me how the repo is supposed to be built.
I ran npm install and then npm run build but there are warnings that I need to install canvas dependency or something.
Also I tried running tests after the build command but half of unit tests failed on fresh clone, I guess I need to do some more building steps but I have no clue how.

@asturur
Copy link
Member

asturur commented Dec 28, 2024

To build the repo you can run 'npm run build'.

  • Clone the repo,
  • run npm install,
    you should be able to run the basics:
    run npm run build or npm run test or npm run test:jest

@asturur
Copy link
Member

asturur commented Dec 28, 2024

I can't get that left/top undefined error to trigger, What should i remove from my tsconfig to have it as an error?

@Smrtnyk
Copy link

Smrtnyk commented Dec 28, 2024

@asturur just uncomment this one line https://github.com/fabricjs/fabric.js/blob/master/tsconfig.json#L92
it is exactOptionalPropertyTypes flag
and then run build
there will be many ts errors, which rollup will spit out to console but still continue hapilly ignoring them exiting with code 0
One of those errors is this one related to Path

@asturur
Copy link
Member

asturur commented Dec 29, 2024

if we have just one error when removing the option we should remove the option imho and fix the error.
i ll try that asap

@Smrtnyk
Copy link

Smrtnyk commented Dec 29, 2024

@asturur I can't guarantee that it will be only 1 error in all projects
It is currently 1 error in my project when that flag is enabled.
Fabric itself has many more errors if you enable that flag in fabrics repo
I checked some of those new errors with that flag in fabricjs repo and lot of them look genuine.
On some places you are defining an object property with undefined value where value should either be defined or not present at all

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

6 participants