Title: Polymorphism doesn't work with mapped type args and strictFunctionTypes · Issue #27984 · microsoft/TypeScript · GitHub
Open Graph Title: Polymorphism doesn't work with mapped type args and strictFunctionTypes · Issue #27984 · microsoft/TypeScript
X Title: Polymorphism doesn't work with mapped type args and strictFunctionTypes · Issue #27984 · microsoft/TypeScript
Description: TypeScript Version: 3.2.0-dev.20181019 Search Terms: readonly polymorphism mapped types interface extend Code interface Base
{ method: (args: Readonly
) => void; } function fn(arg: Base Open Graph Description: TypeScript Version: 3.2.0-dev.20181019 Search Terms: readonly polymorphism mapped types interface extend Code interface Base { method: (args: Readonly ) => void; } function fn(arg: Base X Description: TypeScript Version: 3.2.0-dev.20181019 Search Terms: readonly polymorphism mapped types interface extend Code interface Base<P> { method: (args: Readonly<P>) => void; } function fn(a...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/27984
X: @github
Domain: github.com
{ method: (args: Readonly ) => void; } function fn(arg: Base Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Polymorphism doesn't work with mapped type args and strictFunctionTypes","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.2.0-dev.20181019\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** readonly polymorphism mapped types interface extend\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface Base\u003cP> {\r\n method: (args: Readonly\u003cP>) => void;\r\n}\r\n\r\nfunction fn(arg: Base\u003cany>) { }\r\n\r\n// It works\r\nfn({} as Base\u003c{ foo: string }>)\r\n\r\n// Why error?\r\ninterface Child\u003cP> extends Base\u003cP> { }\r\nfn({} as Child\u003c{ foo: string }>)\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nNo error\r\n\r\n**Actual behavior:**\r\n\r\nError:\r\n```\r\nArgument of type 'Child\u003c{ foo: string; }>' is not assignable to parameter of type 'Base\u003cany>'.\r\n Types of property 'method' are incompatible.\r\n Type '(args: Readonly\u003c{ foo: string; }>) => void' is not assignable to type '(args: Readonly\u003cany>) => void'.\r\n Types of parameters 'args' and 'args' are incompatible.\r\n Type 'Readonly\u003cany>' is not assignable to type 'Readonly\u003c{ foo: string; }>'.\r\n Property 'foo' is missing in type 'Readonly\u003cany>'.\r\n```\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\nEnable `strictFunctionTypes` in Options:\r\nhttps://www.typescriptlang.org/play/index.html#src=interface%20Base%3CP%3E%20%7B%0D%0A%20%20%20%20method%3A%20(args%3A%20Readonly%3CP%3E)%20%3D%3E%20void%3B%0D%0A%7D%0D%0A%0D%0Afunction%20fn(arg%3A%20Base%3Cany%3E)%20%7B%20%7D%0D%0A%0D%0A%2F%2F%20It%20works%0D%0Afn(%7B%7D%20as%20Base%3C%7B%20foo%3A%20string%20%7D%3E)%0D%0A%0D%0A%2F%2F%20Why%20error%3F%0D%0Ainterface%20Child%3CP%3E%20extends%20Base%3CP%3E%20%7B%20%7D%0D%0Afn(%7B%7D%20as%20Child%3C%7B%20foo%3A%20string%20%7D%3E)\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\nMaybe related to #27484","author":{"url":"https://github.com/diegohaz","@type":"Person","name":"diegohaz"},"datePublished":"2018-10-19T06:55:12Z","url":"https://github.com/microsoft/TypeScript/issues/27984"}
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:145ef3eb-a892-89d5-0ab9-2887c40e3975 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id 9564:1F2D:256E495:2F73D62:6B01C14E html-safe-nonce ef6b94b34d1a669244922190a93749e4617a5d82af9907df1898d816505a5a66 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTY0OjFGMkQ6MjU2RTQ5NToyRjczRDYyOjZCMDFDMTRFIiwidmlzaXRvcl9pZCI6IjQ5NDU1MzI0Nzk1MjEwMTQwOTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== visitor-hmac a57ed19e9aae33507af5486e677e6824b8a910989a36b64243db9bf90a2300de hovercard-subject-tag issue:371829025 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/27984/issue_layout twitter:image https://opengraph.githubassets.com/c6a5aca1ab3cbed3aeb094a804bdf4c0183184b530a0acab6eb80aecbd02b4df/microsoft/TypeScript/issues/27984 twitter:card summary_large_image og:image https://opengraph.githubassets.com/c6a5aca1ab3cbed3aeb094a804bdf4c0183184b530a0acab6eb80aecbd02b4df/microsoft/TypeScript/issues/27984 og:image:alt TypeScript Version: 3.2.0-dev.20181019 Search Terms: readonly polymorphism mapped types interface extend Code interface Base og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username diegohaz hostname github.com expected-hostname github.com None cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c 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 8c77c9e8439031ad54c75a250694842892f693e1 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.