Deno support #3129
Replies: 4 comments
-
Update: Just to see, I forked MobX and changed all the imports. There are definitely some other issues, for example: TS7006 [ERROR]: Parameter 'thing' implicitly has an 'any' type.
export function onBecomeObserved(thing, arg2, arg3?): Lambda {
~~~~~
at https://raw.githubusercontent.com/brundonsmith/mobx/main/packages/mobx/src/api/become-observed.ts:31:34
TS2304 [ERROR]: Cannot find name '__DEV__'.
if (__DEV__ && globalState.disableErrorBoundaries === true) {
~~~~~~~
at https://raw.githubusercontent.com/brundonsmith/mobx/main/packages/mobx/src/api/configure.ts:53:9
TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
IMapDidChange,
~~~~~~~~~~~~~
at https://raw.githubusercontent.com/brundonsmith/mobx/main/packages/mobx/src/mobx.ts:65:5 Each of these errors has dozens of instances, and there are other types of errors not listed here. So looks like this would not be a simple task, sadly :( I'd still be excited and willing to help if the project ever decided to address this use-case, but as it stands I understand if this isn't a good use of time. |
Beta Was this translation helpful? Give feedback.
-
That merely looks like the tsconfig that is applied in your fork is
different than that is applied to the original. This might be an issue with
how you compile or bundle things? Does deno automatically pick up tsconfig
of the project, or is there one 'master' setting everything needs to apply
to?
…On Sat, Oct 2, 2021 at 3:19 AM Brandon Smith ***@***.***> wrote:
Update: Just to see, I forked MobX and changed all the imports. There are
definitely some other issues, for example:
TS7006 [ERROR]: Parameter 'thing' implicitly has an 'any' type.export function onBecomeObserved(thing, arg2, arg3?): Lambda {
~~~~~at https://raw.githubusercontent.com/brundonsmith/mobx/main/packages/mobx/src/api/become-observed.ts:31:34
TS2304 [ERROR]: Cannot find name '__DEV__'.if (__DEV__ && globalState.disableErrorBoundaries === true) {
~~~~~~~at https://raw.githubusercontent.com/brundonsmith/mobx/main/packages/mobx/src/api/configure.ts:53:9
TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'. IMapDidChange,~~~~~~~~~~~~~at https://raw.githubusercontent.com/brundonsmith/mobx/main/packages/mobx/src/mobx.ts:65:5
Each of these errors has dozens of instances, and there are other types of
errors not listed here. So looks like this would not be a simple task,
sadly :( I'd still be excited and willing to help if the project ever
decided to address this use-case, but as it stands I understand if this
isn't a good use of time.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3129 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBFEEDYNUN4TN2AOVH3UEZTZ7ANCNFSM5FFVWMSQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
You know what, Deno does have a way to override certain compilerOptions. Let me try doing that when I have some time |
Beta Was this translation helpful? Give feedback.
-
I wasn't able to get this working easily, however, I was able to use MobX in Deno by importing a bundled version from JSPM like so: import { observable, autorun, configure } from "https://jspm.dev/mobx" which I think will work for my purposes, even though it lacks types right now |
Beta Was this translation helpful? Give feedback.
-
I'm interested in using MobX in Deno. I know this isn't exactly MobX's primary use-case, but I think it should be fairly straightforward to support it since MobX doesn't have any dependencies.
For those who don't know, Deno can ingest ESModules/TypeScript directly. It can also import directly from URLs. So a common practice is to import directly from github:
This got as far as trying to import the other modules (utils, errors, etc) before failing. It failed at those because:
GitHub URLs require file extensions, and it happens that Deno does too. This could be the only problem, or it's possible others will turn up if MobX is internally using any bespoke TypeScript options or fancy module-resolution strategies. However, if this is the only problem, it could be as simple as adding file extensions to all internal imports and tweaking the bundler config if necessary to accommodate this. I'd tend to think this wouldn't be a breaking change since most people use a bundled version of MobX, and it would also help get MobX ready for an ESModule future where (I think) those file extensions are also required.
I'd be happy to do legwork on this if there's potential interest in merging such changes! I'm also happy to listen to alternate suggestions on how MobX could be made Deno-ready
Beta Was this translation helpful? Give feedback.
All reactions