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

Incorrect access modifier for SymbolConstructor.observable #39

Closed
agubler opened this issue Jul 30, 2018 · 7 comments
Closed

Incorrect access modifier for SymbolConstructor.observable #39

agubler opened this issue Jul 30, 2018 · 7 comments
Labels
bug Something isn't working

Comments

@agubler
Copy link
Member

agubler commented Jul 30, 2018

@jason0x43 commented on Fri Jun 29 2018

Bug

SymbolConstrutor.observable has the default access modifier in @dojo/shim, but should be readonly. Currently it conflicts with recent node typings, which specifically flag observable as readonly.

Previous versions of the Node typings (< 10, 10.x before May) didn't include the observable property on SymbolConstructor, so fixing this shouldn't cause issues with code using older Node typings.

See also: theintern/intern#932

Package Version:

2.0.0

Code

Create a project that includes @dojo/shim@2.0.0 and @types/node@10.5.1 and try to build it.

Expected behavior:

It compiles.

Actual behavior:

node_modules/@theintern/leadfoot/node_modules/@dojo/shim/Symbol.d.ts:3:9 - error TS2687: All declarations of 'observable' must have identical modifiers.

3         observable: symbol;
          ~~~~~~~~~~


node_modules/@types/node/index.d.ts:169:14 - error TS2687: All declarations of 'observable' must have identical modifiers.

169     readonly observable: symbol;
                 ~~~~~~~~~~
@agubler agubler added the bug Something isn't working label Jul 30, 2018
@mgroenhoff
Copy link
Contributor

I would like to see this one fixed. Should I create a PR for this?

@agubler
Copy link
Member Author

agubler commented Aug 14, 2018

Thanks @mgroenhoff, that would be great.

@mgroenhoff
Copy link
Contributor

mgroenhoff commented Aug 16, 2018

I'm having a bit of trouble fixing this because it is a little more complicated that just prefixing observable with readonly.

This is a subset if the dependency tree:

- @dojo/framework
    - @dojo/scripts
        - intern
            - @dojo/shim <-- ~0.2.7
            - @theintern/leadfoot
                - @dojo/shim <-- ~2.0.0

Using npm install, this results in the following tree:

- node_modules
    - @dojo
        - shim <-- v0.2.7
    - @theintern
        - leadfoot
            - node_modules
                - @dojo
                    - shim <-- v2.0.0

Types of both versions of @dojo/shim's are included within the compilation context and both versions include the following definition in their types:

declare global  {
    interface SymbolConstructor {
        observable: symbol;
    }
}

So if I fix src/shim/Symbol.ts and prefix it with readonly, I can not compile @dojo/framework anymore because I now have multiple different declarations of observable.

The proper way to fix this seems to first fix and release the earlier versions of @dojo/shim, update intern and @theintern/leadfoot use the new version and then fix @dojo/framework.

@agubler
Copy link
Member Author

agubler commented Aug 16, 2018

@mgroenhoff Thanks for the research, intern are in the process of removing their dojo dependencies (partially for these complex dependency reasons), so once that has been completed and released we should be able to fix framework.

@mgroenhoff
Copy link
Contributor

I noticed @dojo/shim was made read-only so I guess the earlier versions can not even be fixed event if you wanted to.

@agubler That would indeed make things a lot easier!

@aciccarello
Copy link
Contributor

For reference theintern/intern#936 is the issue to remove intern's domo dependency.

The symbol definition should still be updated to be readonly in preparation, correct?

interface SymbolConstructor {
observable: symbol;
}

@mgroenhoff
Copy link
Contributor

Correct. But that can only be done after intern and @theintern/leadfoot have their dojo dependencies removed and have been published otherwise you get compile errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants