Title: empty class acts as "any" type: by design or bug? · Issue #5451 · microsoft/TypeScript · GitHub
Open Graph Title: empty class acts as "any" type: by design or bug? · Issue #5451 · microsoft/TypeScript
X Title: empty class acts as "any" type: by design or bug? · Issue #5451 · microsoft/TypeScript
Description: The following typechecks fine: class Empty { } // From a strongly-typed point of view, this feels strange var e1: Empty = "Strange"; var e2: Empty = 42; This also compiles class Foo { name: string; constructor(name: string) { this.name =...
Open Graph Description: The following typechecks fine: class Empty { } // From a strongly-typed point of view, this feels strange var e1: Empty = "Strange"; var e2: Empty = 42; This also compiles class Foo { name: string;...
X Description: The following typechecks fine: class Empty { } // From a strongly-typed point of view, this feels strange var e1: Empty = "Strange"; var e2: Empty = 42; This also compiles class Foo { nam...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/5451
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"empty class acts as \"any\" type: by design or bug?","articleBody":"The following typechecks fine:\n\n```\nclass Empty {\n}\n\n// From a strongly-typed point of view, this feels strange\nvar e1: Empty = \"Strange\";\nvar e2: Empty = 42;\n```\n\nThis also compiles\n\n```\nclass Foo {\n name: string;\n\n constructor(name: string) {\n this.name = name;\n }\n\n hello() {\n return \"456\";\n }\n}\n\nclass Bar {\n name: string;\n\n hello() {\n return \"123\";\n }\n}\n\nvar foo = new Foo(\"Jo\");\n\n// From a strongly-typed point of view, this feels strange\nvar bar: Bar = foo;\n```\n\nIs this by design?\n","author":{"url":"https://github.com/ziriax","@type":"Person","name":"ziriax"},"datePublished":"2015-10-29T12:28:27Z","url":"https://github.com/microsoft/TypeScript/issues/5451"}
| 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:71c39768-da09-f1bc-350a-4e4a0a395aeb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C0E8:2D2F2F:AC4824:E04D10:6B00E6B9 |
| html-safe-nonce | 441f313d914ba3dc04b77449fcad3a881008a20b2e735de9d1fc207215e34ab3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMEU4OjJEMkYyRjpBQzQ4MjQ6RTA0RDEwOjZCMDBFNkI5IiwidmlzaXRvcl9pZCI6IjI5NzAzMjMyMDgxNjg4NTkzMjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1333be09e73ee9e24061ba1fe6489f1002e32c13935547d9be59065dccc65b41 |
| hovercard-subject-tag | issue:114038913 |
| 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/5451/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3610ccf200a2fa59b6cffc1d67643bd5b6dff6b1288c1ed7b46dd20d70b865a4/microsoft/TypeScript/issues/5451 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3610ccf200a2fa59b6cffc1d67643bd5b6dff6b1288c1ed7b46dd20d70b865a4/microsoft/TypeScript/issues/5451 |
| og:image:alt | The following typechecks fine: class Empty { } // From a strongly-typed point of view, this feels strange var e1: Empty = "Strange"; var e2: Empty = 42; This also compiles class Foo { name: string;... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ziriax |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width