example icon indicating copy to clipboard operation
example copied to clipboard

Upgrade to Marblejs 3.0

Open VitalyVrublevskiy opened this issue 4 years ago • 4 comments

@JozefFlakus It would be great to upgrade this example project to later version of framework according to https://docs.marblejs.com/other/migration-guides/version-2

VitalyVrublevskiy avatar Apr 08 '20 16:04 VitalyVrublevskiy

@VitalyVrublevskiy I'm working on new example project which will cover all important aspects of the framework. IMO the current one is too fuzzy. Please be patient :)

JozefFlakus avatar Sep 04 '20 17:09 JozefFlakus

In order to try marble.js I created a non working example using version 3. Perhaps @JozefFlakus I could get a bit of help. I'd like to create an event with payload implementing the EventCreatorWithPayload. As you may see in the linked effect: https://github.com/virgiliolino/marblejs-math/blob/main/src/shape/effects/createShape.effect.ts and in https://github.com/virgiliolino/marblejs-math/blob/main/src/shape/effects/postShape.effect.ts In both the compiler expects me to send an EventCreatorWithoutPayload. what should I change in order to pass a payload to the event? Many thanks, Virgilio

virgiliolino avatar Oct 11 '20 07:10 virgiliolino

I probably spot the problem - tsconfig. The issue looked suspicious then as a last test I copy and pasted tsconfig from my different project. Right now I'm not sure which configuration element breaks the type correct event builder type inference.

Try this:

{
   "compilerOptions": {
     "emitDecoratorMetadata": true,
     "experimentalDecorators": true,
     "module": "commonjs",
     "moduleResolution": "node",
     "noEmitOnError": true,
     "pretty": true,
     "strict": true,
     "target": "es6",
     "outDir": "./dist/",
     "rootDir": "./src",
     "sourceMap": true,
     "typeRoots": [
       "node_modules/@types"
     ],
     "lib": [
       "ES2020"
     ]
   },
   "inputs": [
     "src"
   ]
 }

instead of:

{
   "compilerOptions": {
      "lib": [
         "es5",
         "es6"
      ],
      "target": "es5",
      "module": "commonjs",
      "moduleResolution": "node",
      "outDir": "./build",
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "sourceMap": true
   }
}

JozefFlakus avatar Oct 11 '20 08:10 JozefFlakus

Many thanks it looks like it worked.

virgiliolino avatar Oct 11 '20 12:10 virgiliolino