Skip to content

Infer from filtering mapped types#52972

Closed
Andarist wants to merge 21 commits intomicrosoft:mainfrom
Andarist:infer-from-filterin-mapped-types
Closed

Infer from filtering mapped types#52972
Andarist wants to merge 21 commits intomicrosoft:mainfrom
Andarist:infer-from-filterin-mapped-types

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

This implements a subset of the implied feature request from this issue: #46602

@typescript-bot
Copy link
Copy Markdown
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Feb 25, 2023
@sandersn
Copy link
Copy Markdown
Member

sandersn commented Mar 7, 2023

Can you open a bug for that implied feature request? It makes it a lot easier for me to guess how much we want this feature.

@sandersn sandersn requested review from ahejlsberg and sandersn March 7, 2023 01:00
@sandersn sandersn self-assigned this Mar 7, 2023
@Andarist
Copy link
Copy Markdown
Contributor Author

Andarist commented Mar 7, 2023

@sandersn I think that the referenced issue already does that. The reason why I didn't tag this PR as closing that issue is that the examples there are using renaming mapped types but I'm only fixing here filtering ones. The title of the issue is "Parameter type isn't inferred in values of mapped type with as." and this PR implements support for a subset of that.

Why I didn't cover the other part of the story? There is no machinery in the compiler for reverse mapping the "computed" property name (the source property name) against the target's name type. However, there are already a couple of places that specifically handle those "filtering" mapped types (as they are way easier to handle).

…apped-types

# Conflicts:
#	src/compiler/checker.ts
@Andarist Andarist force-pushed the infer-from-filterin-mapped-types branch from 379bc27 to 22fec49 Compare March 19, 2023 17:13
@Andarist
Copy link
Copy Markdown
Contributor Author

@jakebailey could you create a playground for this one? :)

@Andarist Andarist force-pushed the infer-from-filterin-mapped-types branch from f6f759b to fe90e8a Compare September 20, 2023 09:48
@jakebailey
Copy link
Copy Markdown
Member

@typescript-bot pack this

@typescript-bot
Copy link
Copy Markdown
Collaborator

typescript-bot commented Sep 20, 2023

Heya @jakebailey, I've started to run the tarball bundle task on this PR at fe90e8a. You can monitor the build here.

@typescript-bot
Copy link
Copy Markdown
Collaborator

typescript-bot commented Sep 20, 2023

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/157832/artifacts?artifactName=tgz&fileId=4FF3D4BA8C1DA40FA9800B9EB1BF585E940A5781DAC01DFE8FB9C6791FE46B0902&fileName=/typescript-5.3.0-insiders.20230920.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@Andarist
Copy link
Copy Markdown
Contributor Author

@jakebailey could you build a fresh playground for this one?

@jakebailey
Copy link
Copy Markdown
Member

@typescript-bot pack this

@typescript-bot
Copy link
Copy Markdown
Collaborator

typescript-bot commented Nov 27, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Copy Markdown
Collaborator

typescript-bot commented Nov 27, 2024

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/164232/artifacts?artifactName=tgz&fileId=38FDB090EBAD3697EEED729881CBE4740494F4C9FEABE090519C5163A57B8BB602&fileName=/typescript-5.8.0-insiders.20241127.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@Andarist Andarist force-pushed the infer-from-filterin-mapped-types branch from 65127f6 to 9deef9d Compare January 13, 2025 07:18
@Andarist Andarist force-pushed the infer-from-filterin-mapped-types branch from e4ebbbf to 9851814 Compare December 5, 2025 17:39
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Done in PR Backlog Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants