FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merged Declarations for Classes and Interfaces by aozgaa · Pull Request #3333 · microsoft/TypeScript · GitHub

Merged Declarations for Classes and Interfaces - #3333

Merged
Arthur Ozga (aozgaa) merged 37 commits into
microsoft:masterfrom
aozgaa:mergedDeclarationClassInterface
Jul 2, 2015
Merged

Merged Declarations for Classes and Interfaces#3333
Arthur Ozga (aozgaa) merged 37 commits into
microsoft:masterfrom
aozgaa:mergedDeclarationClassInterface

Conversation

Copy link
Copy Markdown
Contributor

This implements the proposal in #3332.

Hi Arthur Ozga (@aozgaa), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Arthur Ozga). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

Comment thread src/compiler/binder.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This isn't exported, so you don't need this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Changed.

Comment thread src/compiler/binder.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit: Can you put single quotes around node just so this reads easier? Thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Changed.

Comment thread src/compiler/types.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If you do the other change I suggested (https://github.com/Microsoft/TypeScript/pull/3333/files#r31552915), then this goes away, and ClassExcludes becomes (Value | Type) & ~(ValueModule | Interface)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

why not just letting classes and interfaces merge, and reporting an error later on in CheckClassDeclaration for instance if the class is not ambient? just like we do with merging order for module/class and module/class being in different files.

Comment thread src/compiler/binder.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

should not this be inAmbientContext instead?

Copy link
Copy Markdown
Contributor

👍

Copy link
Copy Markdown
Contributor Author

Comment thread src/compiler/binder.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Remove the leading space if you get the chance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

fixed.

Copy link
Copy Markdown
Member

There are apparently some issues with the build - you probably need to fix up baselines that don't agree with the merge.

Copy link
Copy Markdown
Contributor Author

Daniel Rosenwasser (@DanielRosenwasser) The error codes needed to be changed as part of merging the upstream fixes and this broke some of the baselines. No other errors occurred. They've been added now :).

Copy link
Copy Markdown
Contributor

👍

1 similar comment

Copy link
Copy Markdown
Member

👍

Arthur Ozga (aozgaa) pushed a commit that referenced this pull request Jul 2, 2015
Merged Declarations for Classes and Interfaces
Arthur Ozga (aozgaa) merged commit 6775d88 into microsoft:master Jul 2, 2015

Copy link
Copy Markdown
Member

This should be added to the Roadmap and What's New In TypeScript page.

Copy link
Copy Markdown

How does this work with imported module?

When I have like this application.ts

import * as amqp from 'amqplib';

// I want to merge declaration with `interface amqp.ExchangeOptions`
interface ExchangeOptions {
  'x-recent-history-length' : number;
}

interface amqp.ExchangeOptions {
  'x-recent-history-length' : number;
}

Which one should work?

Copy link
Copy Markdown
Contributor

Neither one of those would work here. You'd need to do the following:

declare module 'amqplib' {
    interface ExchangeOptions {
       'x-recent-history-length' : number;
    }
}

Copy link
Copy Markdown

Thanks!

Copy link
Copy Markdown
Contributor

Jason Freeman (@JsonFreeman) Is there an equivalent for external modules?

Copy link
Copy Markdown
Contributor

Asad Saeeduddin (@masaeedu) please see #6213

Copy link
Copy Markdown

This doesn't appear to be possible but feels like it should:

interface Foo {
    readonly name: string
}

class Foo {
    constructor(name: string) {
        this.name = name; //error
    }    
}

Copy link
Copy Markdown
Member

Nicholas Bransby-Williams (@nbransby) thanks, I'll open an issue for you.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL