Skip to content

fix: filtering promise properties in object literal completion - #59316

Merged
Jake Bailey (jakebailey) merged 7 commits into
microsoft:mainfrom
syi0808:fix/not-return-promise-types-in-union
Aug 9, 2024
Merged

fix: filtering promise properties in object literal completion#59316
Jake Bailey (jakebailey) merged 7 commits into
microsoft:mainfrom
syi0808:fix/not-return-promise-types-in-union

Conversation

@syi0808

@syi0808 Yein Sung (syi0808) commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

screenshot

스크린샷 2024-07-17 오후 4 08 23

In the actual development environment, it was possible to reproduce what was solved.
But I can't find a case to write a test. Can someone give me an idea?

Fixes #59298

@Andarist

Copy link
Copy Markdown
Contributor

Tests for completions can be written like this:
https://github.com/microsoft/TypeScript/blob/f37482cd16118409284e015409deaf14b416b4a0/tests/cases/fourslash/completionsPropertiesPriorities.ts

Comment thread src/compiler/checker.ts Outdated
@syi0808
Yein Sung (syi0808) marked this pull request as draft July 17, 2024 15:11
@typescript-bot TypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jul 17, 2024
@syi0808
Yein Sung (syi0808) force-pushed the fix/not-return-promise-types-in-union branch from 99ef608 to 63999d3 Compare July 20, 2024 17:23
@syi0808
Yein Sung (syi0808) marked this pull request as ready for review July 20, 2024 17:23
@syi0808
Yein Sung (syi0808) force-pushed the fix/not-return-promise-types-in-union branch 2 times, most recently from 089a830 to 3e8aafd Compare July 20, 2024 17:39
@syi0808 Yein Sung (syi0808) changed the title fix: filtering promise types in normal function return type fix: filtering promise properties in object literal completion Jul 21, 2024
@syi0808
Yein Sung (syi0808) force-pushed the fix/not-return-promise-types-in-union branch from 3e8aafd to be95930 Compare July 21, 2024 16:04
@typescript-bot

Copy link
Copy Markdown
Contributor

Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.

Also, please make sure Daniel Rosenwasser (@DanielRosenwasser) and Ryan Cavanaugh (@RyanCavanaugh) are aware of the changes, just as a heads up.

@syi0808
Yein Sung (syi0808) force-pushed the fix/not-return-promise-types-in-union branch from be95930 to 994cc76 Compare July 21, 2024 16:24
Comment thread src/compiler/types.ts Outdated
Comment thread src/compiler/types.ts Outdated
@typescript-bot TypeScript Bot (typescript-bot) added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 3, 2024
@jakebailey

Copy link
Copy Markdown
Member

This looks good to me, though #59316 was accepted without determining whether or not the items should be prioritized or filtered, and this PR filters them out entirely.

I assume that ordering them is going to be a challenge, so are we okay with not providing promise-like method completions here?

@andrewbranch

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) pack this

@typescript-bot

TypeScript Bot (typescript-bot) commented Aug 8, 2024

Copy link
Copy Markdown
Contributor

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

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot

TypeScript Bot (typescript-bot) commented Aug 8, 2024

Copy link
Copy Markdown
Contributor

Hey Andrew Branch (@andrewbranch), 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/163182/artifacts?artifactName=tgz&fileId=FB6676671E04A4C6C1239CBAE0D3D2733BB015E08A215E8561269BB16027CF7302&fileName=/typescript-5.6.0-insiders.20240808.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/pr-build@5.6.0-pr-59316-5".;

Comment thread src/services/completions.ts Outdated
@jakebailey
Jake Bailey (jakebailey) merged commit f3b118e into microsoft:main Aug 9, 2024
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid providing promise methods as completions at return positions in non-async functions

6 participants