Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Export Container and BaseContainer type is misleading #10

Open
cychiuae opened this issue Mar 8, 2019 · 1 comment
Open

Export Container and BaseContainer type is misleading #10

cychiuae opened this issue Mar 8, 2019 · 1 comment

Comments

@cychiuae
Copy link
Contributor

cychiuae commented Mar 8, 2019

If we look at https://github.com/SkygearIO/skygear-SDK-JS/blob/v1.7.1/packages/skygear-core/lib/index.js and https://github.com/SkygearIO/skygear-SDK-JS/blob/v1.7.1/packages/skygear-core/lib/container.js, we will find that the class Container and BaseContainer aren't exported.

However, because

export class BaseContainer {
and
export class Container extends BaseContainer {
, we have set a trap for developers.

Consider the following code

// index.ts
import { Container } from 'skygear';

const container = new Container()

The little piece of code can pass typecheck. However, actually it will crash in runtime.

@cychiuae
Copy link
Contributor Author

cychiuae commented Mar 8, 2019

cc @limouren @louischan-oursky

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

No branches or pull requests

1 participant