1

I am new to Mithril. I am trying to follow this example for a pretty basic start: https://github.com/spacejack/mithril-ts-example. Here are my package.json, and tsconfig.json :

# package.json
{
  "dependencies": {
    "browserify": "^17.0.0",
    "budo": "^11.6.4",
    "mithril": "^2.0.4",
    "tsify": "^5.0.4"
  },
  "devDependencies": {
    "@types/mithril": "github:MithrilJS/mithril.d.ts#next"
  },
  "name": "web_client",
  "version": "1.0.0",
  "main": "index.ts",
  "scripts": {
    "compile": "browserify --debug src/main.ts -p [ tsify --project ./src/tsconfig.json ] -o public/js/app.js",
    "build": "browserify src/main.ts -p [ tsify --project ./src/tsconfig.json ] | uglifyjs -cm -o public/js/app.js",
    "clean": "rm -f public/js/app.js",
    "start": "budo src/main.ts:js/app.js -p 3000 --dir public --live=*.{html,js,css} -- --debug -p [ tsify --project ./src/tsconfig.json ]"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}
# tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "esModuleInterop": true,
    "lib": ["dom", "es2015"],
    "strict": true
  },
  "files": ["./main.ts"]
}

Finally, here is my traceback:

web_client npm start

> web_client@1.0.0 start
> budo src/main.ts:js/app.js -p 3000 --dir public --live=*.{html,js,css} -- --debug -p [ tsify --project ./src/tsconfig.json ]

[0000] info  Server running at http://192.168.1.60:3000/ (connect)
[TypeScript error: /home/nina/Documents/school/AREA/web_client/node_modules/@types/mithril/index.d.ts(28,44): Error TS2344: Type 'State' does not satisfy the constraint 'Lifecycle<Attrs, State>'.] {
  fileName: '/home/nina/Documents/school/AREA/web_client/node_modules/@types/mithril/index.d.ts',
  line: 28,
  column: 44
}
[0000] info  LiveReload running
[0000] info  LiveReload filtering filenames with glob: *.%7Bhtml,js,css%7D

I have search everywhere but it seems that nobody had the exact same error as me. What did I do wrong?

Adina
  • 149
  • 6

0 Answers0