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

Typescript errors in 0.1.36 #312

Open
nileshtrivedi opened this issue Aug 23, 2023 · 4 comments
Open

Typescript errors in 0.1.36 #312

nileshtrivedi opened this issue Aug 23, 2023 · 4 comments

Comments

@nileshtrivedi
Copy link

✘ [ERROR] Transforming JavaScript decorators to the configured target environment ("es2016") is not supported yet

node_modules/@mathigon/studio/frontend/course.ts:38:0:
38 │ @register('x-course')
╵ ^

✘ [ERROR] Transforming JavaScript decorators to the configured target environment ("es2016") is not supported yet

node_modules/@mathigon/studio/frontend/accounts.ts:54:0:
54 │ @register('x-password', {template})

Also this:

TSError: ⨯ Unable to compile TypeScript:
node_modules/@mathigon/studio/server/utilities/utilities.ts:79:21 - error TS2345: Argument of type '{}' is not assignable to parameter of type 'Obj'.
Index signature for type 'string' is missing in type '{}'.

79 deep ? deepExtend(studio, project, (a, b) => b) : Object.assign(studio as any, project);
at createTSError (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.require.extensions. [as .ts] (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19) {
diagnosticCodes: [ 2345 ]
}

I see this error when running npm start for the latest commit in the textbooks repo which changed studio dependency from 0.1.35 to 0.1.36.

node -v
v18.15.0

npm -v
9.5.0

@nileshtrivedi
Copy link
Author

I suspect that the bundleScripts method in assets.js (which is used as mgon-build) is not passing compiler options correctly.

@mougedashu
Copy link

`> @mathigon/[email protected] start

npm-run-all --parallel watch server

@mathigon/[email protected] watch
mgon-build --assets --watch --locales en

@mathigon/[email protected] server
mgon-serve

✔ Built icons.svg in 36ms
I:\01_代码\mathigon.org\textbooks\node_modules\ts-node\src\index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
node_modules/@mathigon/studio/server/utilities/utilities.ts:79:21 - error TS2345: Argument of type '{}' is not assignable to parameter of type 'Obj'.
Index signature for type 'string' is missing in type '{}'.

79 deep ? deepExtend(studio, project, (a, b) => b) : Object.assign(studio as any, project); ~~~~~~

at createTSError (I:\01_代码\mathigon.org\textbooks\node_modules\ts-node\src\index.ts:859:12)
at reportTSError (I:\01_代码\mathigon.org\textbooks\node_modules\ts-node\src\index.ts:863:19)
at getOutput (I:\01_代码\mathigon.org\textbooks\node_modules\ts-node\src\index.ts:1077:36)
at Object.compile (I:\01_代码\mathigon.org\textbooks\node_modules\ts-node\src\index.ts:1433:41)
at Module.m._compile (I:\01_代码\mathigon.org\textbooks\node_modules\ts-node\src\index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.require.extensions.<computed> [as .ts] (I:\01_代码\mathigon.org\textbooks\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19) {

diagnosticCodes: [ 2345 ]
}
ERROR: "server" exited with 1.`
I have also encountered a similar error. How can I solve it? Thank you!

@nileshtrivedi
Copy link
Author

@mougedashu I think this has been fixed in this commmit but studio package has not been published to npm yet.

For now, you can try replacing @mathigon/studio version 0.1.37 to @dhimath/studio version 0.1.38. But you will also have to replace all import statements in files like functions.ts to import ... from '@dhimath/studio';

@plegner If you could publish latest version of the studio package, that would be great. BTW, the docs/example shows this error:

image

@mougedashu
Copy link

mougedashu commented Sep 19, 2023

@nileshtrivedi,I have successfully solved the problem according to the method you provided. Thank you!

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

No branches or pull requests

2 participants