Title: Faulty declarations file from extending generic base class · Issue #17805 · microsoft/TypeScript · GitHub
Open Graph Title: Faulty declarations file from extending generic base class · Issue #17805 · microsoft/TypeScript
X Title: Faulty declarations file from extending generic base class · Issue #17805 · microsoft/TypeScript
Description: TypeScript Version: 2.4.1 Code declare type Newable
Open Graph Description: TypeScript Version: 2.4.1 Code declare type Newable X Description: TypeScript Version: 2.4.1 Code declare type Newable<TType> = { new (...params: any[]): TType; }; interface Bar<T>{ (): T; } const FooBar = {}; class Foo<TItem> extends (FooBar as ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/17805
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Faulty declarations file from extending generic base class","articleBody":"**TypeScript Version:** 2.4.1\r\n\r\n**Code**\r\n\r\n```ts\r\ndeclare type Newable\u003cTType> = {\r\n new (...params: any[]): TType;\r\n}; \r\n\r\ninterface Bar\u003cT>{\r\n (): T;\r\n}\r\n\r\nconst FooBar = {};\r\n\r\nclass Foo\u003cTItem> extends (FooBar as any as Newable\u003cBar\u003cTItem>>) {\r\n\r\n}\r\n```\r\n**Expected behavior:**\r\nThe generated declaration file should contain the following\r\n```ts\r\ndeclare type Newable\u003cTType> = {\r\n new (...params: any[]): TType;\r\n};\r\ninterface Bar\u003cT> {\r\n (): T;\r\n}\r\ndeclare const FooBar: {};\r\ndeclare const Foo_base: Newable\u003cBar\u003cany>>;\r\ndeclare class Foo\u003cTItem> extends Foo_base {\r\n}\r\n```\r\n\r\n**Actual behavior:**\r\n\r\n```ts\r\ndeclare type Newable\u003cTType> = {\r\n new (...params: any[]): TType;\r\n};\r\ninterface Bar\u003cT> {\r\n (): T;\r\n}\r\ndeclare const FooBar: {};\r\ndeclare const Foo_base: Newable\u003cBar\u003cTItem>>; // \u003c----- TItem is not defined\r\ndeclare class Foo\u003cTItem> extends Foo_base {\r\n}\r\n```\r\n\r\nWhen the generated declarations file is referenced by other code, the compilation fails with\r\n> error TS2304: Build:Cannot find name 'TItem'.","author":{"url":"https://github.com/NoelAbrahams","@type":"Person","name":"NoelAbrahams"},"datePublished":"2017-08-15T14:29:53Z","url":"https://github.com/microsoft/TypeScript/issues/17805"}
react-profiling 0 react-import-map react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:e3a2e7a7-4bd5-3b72-4b7a-d45285aa7e31 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id D518:A71F9:E1D3E:11BB4E:6B00F75C html-safe-nonce 37892e5a3e7c42302ca80865e381ab0ae9b23081e6972b8fc0bee6d9204b0df8 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTE4OkE3MUY5OkUxRDNFOjExQkI0RTo2QjAwRjc1QyIsInZpc2l0b3JfaWQiOiI0NTAyMzMzMDk5MTQ0NzA1ODg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= visitor-hmac 6edf9fc6ad17787f7b23f6ebac296da0ee003984ab439dc65706aa461c145b3e hovercard-subject-tag issue:250331847 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/17805/issue_layout twitter:image https://opengraph.githubassets.com/6afa58ca3210f4d2c3d165e3492cdb5bed301505e09410c5bdac9f21c8b483cb/microsoft/TypeScript/issues/17805 twitter:card summary_large_image og:image https://opengraph.githubassets.com/6afa58ca3210f4d2c3d165e3492cdb5bed301505e09410c5bdac9f21c8b483cb/microsoft/TypeScript/issues/17805 og:image:alt TypeScript Version: 2.4.1 Code declare type Newable og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username NoelAbrahams hostname github.com expected-hostname github.com None 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc turbo-cache-control no-preview go-import github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git octolytics-dimension-user_id 6154722 octolytics-dimension-user_login microsoft octolytics-dimension-repository_id 20929025 octolytics-dimension-repository_nwo microsoft/TypeScript octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 20929025 octolytics-dimension-repository_network_root_nwo microsoft/TypeScript turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 9983dd5da06943f833c971dd5b6bc988e2858be5 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.