Skip to content

In JS, cross-file non-expando assignment declarations are broken #26875

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

Closed
sandersn opened this issue Sep 4, 2018 · 2 comments
Closed

In JS, cross-file non-expando assignment declarations are broken #26875

sandersn opened this issue Sep 4, 2018 · 2 comments
Labels
Bug A bug in TypeScript

Comments

@sandersn
Copy link
Member

sandersn commented Sep 4, 2018

From chrome-devtools-frontend (found in #26861)

// @Filename: file1.js
var N = {}
N.commands = {}

// @Filename: file2.js
N.commands.a = 111
N.commands.b = function () { }

Expected behavior:
N.commands.a = 111 is a legal assignment declaration and references to N.commands.a have type number.

Actual behavior:
Both N.commands.a = 111 and references to N.commands.a say that "'a' is not found on 'commands'". N.commands.b is fine, though.

Very likely a result of the change to expando marking.

@sandersn
Copy link
Member Author

sandersn commented Sep 4, 2018

This is not a 3.1 regression. It repros in 3.0 too.

Correction: There is no error in 3.0, although the type of 'a' is 'any'.

@sandersn sandersn added Bug A bug in TypeScript Salsa labels Sep 4, 2018
@sandersn
Copy link
Member Author

sandersn commented Sep 4, 2018

Completion is also hilariously broken. It suggests N.commands.N.N.N.N.N.N, although it gives the error "N does not exist on typeof commands".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

1 participant