Hi there,

I'm having trouble with the typings build. It's complaining a lot about Mithril. I'm not sure what's going on here. This is from the Github Action. I'm using Typescript.

But I see the same issue trying to run the typings build script locally

Error: ../vendor/flarum/core/js/dist-typings/@types/global.d.ts(24,28): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/@types/global.d.ts(59,25): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/@types/global.d.ts(60,36): error TS2307: Cannot find module 'dayjs' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/admin/components/AdminPage.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/admin/components/ExtensionPage.d.ts(6,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/admin/components/PermissionGrid.d.ts(3,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/admin/utils/ExtensionData.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/Application.d.ts(12,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/Component.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/components/Alert.d.ts(2,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/components/Button.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/components/Modal.d.ts(3,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/components/ModalManager.d.ts(2,10): error TS2305: Module '"../utils/focusTrap"' has no exported member 'FocusTrap'.
Error: ../vendor/flarum/core/js/dist-typings/common/components/ModalManager.d.ts(4,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/components/Page.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/models/Discussion.d.ts(3,21): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/models/User.d.ts(4,21): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/resolvers/DefaultResolver.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/states/AlertManagerState.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/utils/Drawer.d.ts(10,38): error TS2694: Namespace '"/home/runner/work/featured-projects/featured-projects/vendor/flarum/core/js/dist-typings/common/utils/focusTrap"' has no exported member 'FocusTrap'.
Error: ../vendor/flarum/core/js/dist-typings/common/utils/RequestError.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/utils/Stream.d.ts(1,20): error TS2307: Cannot find module 'mithril/stream' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/utils/focusTrap.d.ts(1,53): error TS2307: Cannot find module 'focus-trap' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/common/utils/focusTrap.d.ts(19,15): error TS2307: Cannot find module 'focus-trap' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/forum/components/ComposerBody.d.ts(40,36): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/forum/components/DiscussionPage.d.ts(1,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/forum/components/IndexPage.d.ts(3,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/forum/components/Notification.d.ts(3,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
Error: ../vendor/flarum/core/js/dist-typings/forum/components/Post.d.ts(5,26): error TS2307: Cannot find module 'mithril' or its corresponding type declarations.
  • You should set enable_typescript to false in the workflow file. As far as I remember there is an unsolved problem with checking typings in extensions, I don't recall the details of it and if the problem is exclusive to GitHub actions.

You should set enable_typescript to false in the workflow file. As far as I remember there is an unsolved problem with checking typings in extensions, I don't recall the details of it and if the problem is exclusive to GitHub actions.

    SychO Thanks!

    with enable_typescript set to false, would typescript still work?

    I do get the same errors running the typings build related commands locally though. So not sure if this is related to Github actions?

    I remember having a similar issue before. I ended up abandoning Typescript because of it, but I would really prefer to use Typescript (especially for commercial extensions) if possible.

      MikeLundahl with enable_typescript set to false, would typescript still work?

      you can still use typescript, only the workflow will not run the check typings command anymore (which is what is failing).

        SychO Thanks! I tried it, and it worked. Perhaps a dumb question, but what are the benefits lost when not running the typings command (assuming it being in a working state)? Is there any plans to have that fixed?

          MikeLundahl what are the benefits lost

          Just being able to detect any typing issues in your entire code rather than waiting to notice/see it in the IDE when you mutate the specific code section.

          MikeLundahl Is there any plans to have that fixed?

          Yea, it's one of many items. At some point hopefully.