Skip to content

Double Instances of Types breaks instanceof checks #643

@leeyi45

Description

@leeyi45

Tabs can import bundles directly using the full package name. i.e import '@sourceacademy/bundle-curve';.

Both bundles and tabs can import modules-lib: import { glAnimation } from '@sourceacademy/modules-lib/types';

When both the tab and bundle get built, a separate copy of modules-lib gets bundled into each. This causes there to be in effect, 2 instances of the glAnimation type, one used by the tab and one used by the bundle.

This means that at runtime, the glAnimation.isAnimation check can fail.

This issue of course will extend to any other modules-lib type, but right now there aren't any other types to extend from.

This issue also extends to types exported by bundles, since a tab is likely going to have its own copy of a bundle's code.

Module What Fixed Fixed by
curve Animations #640
rune
  • Hollusion Runes
  • Animations
#640

Possible bundles to pay attention to:

  • communication
  • game
  • robot_simulation

Based on what I've seen, the conductor migration may require each bundle export much simpler types, which would help solve this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions