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

Add error for using generalized expressions with export assignments in ambient contexts #18444

Merged
merged 1 commit into from
Sep 14, 2017

Conversation

weswigham
Copy link
Member

Fixes #17991

@mhegazy mhegazy added the Breaking Change Would introduce errors in existing code label Sep 14, 2017
@mhegazy mhegazy added this to the TypeScript 2.6 milestone Sep 14, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Sep 14, 2017

@weswigham weswigham merged commit 76eab54 into microsoft:master Sep 14, 2017
@weswigham weswigham deleted the error-ambient-export-equal branch September 14, 2017 18:18
@weswigham
Copy link
Member Author

@mhegazy done.

@ghost
Copy link

ghost commented Sep 18, 2017

@weswigham I thought we were going to allow export = class? DefinitelyTyped/types/express-brute-mongo is broken by this.

@weswigham
Copy link
Member Author

@andy-ms Nope, we said identifier or qualified name only. export default class gets a pass, since it gets parsed as a modifier on a class statement (rather than a default exported class expression) (and causes appropriate grammatical errors on the class from an ambient context); export =, however, always parses as an expression; ergo: only identifiers or qualified names allowed in ambient contexts.
cc @mhegazy for feedback.

@andy-ms, can it be rewritten as

import { Collection } from "mongodb";

/**
 * @summary MongoDB store adapter.
 * @class
 */
class MongoStore {
    /**
     * @summary Constructor.
     * @constructor
     * @param {Function} getCollection The collection.
     * @param {Object}   options       The otpions.
     */
    constructor(getCollection: (collection: (c: Collection) => void) => void, options?: Object);
}
export = MongoStore;

?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Breaking Change Would introduce errors in existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants