{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/17293","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/17293/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/17293/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/17293/events","html_url":"https://github.com/Microsoft/TypeScript/issues/17293","id":244031424,"number":17293,"title":"Unexpected TS4094 with the build parameter `declaration: true`","user":{"login":"saschanaz","id":3396686,"avatar_url":"https://avatars2.githubusercontent.com/u/3396686?v=4","gravatar_id":"","url":"https://api.github.com/users/saschanaz","html_url":"https://github.com/saschanaz","followers_url":"https://api.github.com/users/saschanaz/followers","following_url":"https://api.github.com/users/saschanaz/following{/other_user}","gists_url":"https://api.github.com/users/saschanaz/gists{/gist_id}","starred_url":"https://api.github.com/users/saschanaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saschanaz/subscriptions","organizations_url":"https://api.github.com/users/saschanaz/orgs","repos_url":"https://api.github.com/users/saschanaz/repos","events_url":"https://api.github.com/users/saschanaz/events{/privacy}","received_events_url":"https://api.github.com/users/saschanaz/received_events","type":"User","site_admin":false},"labels":[{"id":113970366,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21","default":false},{"id":670961382,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Domain:%20Declaration%20Emit","name":"Domain: Declaration Emit","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":{"login":"weswigham","id":2932786,"avatar_url":"https://avatars3.githubusercontent.com/u/2932786?v=4","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false},"assignees":[{"login":"weswigham","id":2932786,"avatar_url":"https://avatars3.githubusercontent.com/u/2932786?v=4","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/56","html_url":"https://github.com/Microsoft/TypeScript/milestone/56","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/56/labels","id":2796126,"number":56,"title":"TypeScript 2.7","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars3.githubusercontent.com/u/8000722?v=4","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"open_issues":170,"closed_issues":162,"state":"open","created_at":"2017-09-26T21:34:46Z","updated_at":"2017-12-05T21:19:02Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2017-07-19T12:57:47Z","updated_at":"2017-12-06T14:43:42Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**TypeScript Version:**  2.4.1\r\n\r\n**Code**\r\n\r\n```ts\r\nvar Foo = class Foo {\r\n    private _message = \"Hi\";\r\n    hi() { return this._message; }\r\n}\r\n```\r\n\r\n`tsc test.ts -t es2017 -d`\r\n\r\n**Expected behavior:** `-d` should not cause this message: `test.ts(1,5): error TS4094: Property '_message' of exported class expression may not be private or protected.`\r\n\r\n**Actual behavior:** It does.\r\n\r\nThere should at least be a suppression parameter to ignore this error."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/349659801","html_url":"https://github.com/Microsoft/TypeScript/issues/17293#issuecomment-349659801","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/17293","id":349659801,"user":{"login":"weswigham","id":2932786,"avatar_url":"https://avatars3.githubusercontent.com/u/2932786?v=4","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false},"created_at":"2017-12-06T14:43:42Z","updated_at":"2017-12-06T14:43:42Z","author_association":"MEMBER","body":"Like many of our still-open declaration emit issues, fixing this would require significant changes to our declaration emit. Today, we'll try to emit the example in the OP as:\r\n```ts\r\ndeclare var Foo: {\r\n  new (): {\r\n    // Try to write type for `_message` here\r\n    hi(): string;\r\n  }\r\n}\r\n```\r\nexcept since we're in an anonymous object literal type, there is no way to write a private or protected member, so instead we write a visibility error and refuse to generate declarations. The only \"correct\" thing to do to fix this is to generate an interface for `Foo`'s instance type, that way member modifiers can be preserved. The issue with that is that generating an interface would change the publicly visible declarations for your file (namely, it would introduce one you never actually wrote, but was implicit in the usage of a class expression).\r\n\r\nFor now, the workaround is to explicitly give a type to your `var Foo = /* ... */`, ie `var Foo: {new(): IFoo} = /* ... */`, where you've defined `IFoo`.\r\n\r\nThe reason this issue and others like it (issues assigned to me in the category of declaration emit which I have not already created fixes for) are sitting for so long is because we're in the process of overhauling our declaration emitter to make it easier to generate things like these implicit interfaces (or imports, dependent variables, etc) without changing the public shape of your declaration file, and it's a long process to do the refactoring (generally speaking, big changes are difficult to review, and this is a series of big changes). We _are_ replacing a 3-yr-old subsystem that contains >2000 LOC, countless edge-cases and deep connections to the type checker and emitter, after all. ;)\r\n\r\nWe _are_ working on it, though. While I can't make any promises for this specific issue, we're hoping to have the prerequisite changes we want to make to make this possible done in the 2.7 timeframe."}}
{"actor":{"display_login":"weswigham"}}