Skip to content

Bug/57553 resolve conflicts #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2e4f2c7
Include non-enumerable keys in __importStar helper (#60262)
rbuckton Oct 18, 2024
c07da58
Disallow type and interface declarations in statements with blockless…
Andarist Oct 18, 2024
df9d165
fix(59463): Feature that displays method argument names inline does n…
a-tarasyuk Oct 18, 2024
e6ef279
Fix template string escaping (#60303)
rbuckton Oct 21, 2024
d9eeeae
Bump github/codeql-action from 3.26.12 to 3.26.13 in the github-actio…
dependabot[bot] Oct 21, 2024
aa411ac
Add a test for constraint of an infer type parameter not being fully …
Andarist Oct 21, 2024
e25abe3
Error on too many parameters for iterator method (#60321)
rbuckton Oct 22, 2024
241a6c9
fix(55168): Computed properties do not respect setter signatures (#55…
a-tarasyuk Oct 22, 2024
a62ac67
fix(59779): The semicolons: "remove" formatting option doesn't remove…
a-tarasyuk Oct 22, 2024
1679f44
More rigorous ASI prevention when emitting `return`/`yield` (#60304)
rbuckton Oct 22, 2024
437d7f7
Fixed crash in auto import suggestions for `default` of exported UMD …
Andarist Oct 23, 2024
6a90111
Fixed "add missing properties" codefix for positions with nullable co…
Andarist Oct 23, 2024
db8eacd
fix(59397): JsDoc is missing/duplicated in declarations for overloads…
a-tarasyuk Oct 23, 2024
2ac4cb7
Fix prioritization of `paths` specifiers over node_modules package sp…
andrewbranch Oct 23, 2024
6beca69
Bump the github-actions group with 4 updates (#60356)
dependabot[bot] Oct 28, 2024
cb44488
Fixed a JSDoc-related crash when obtaining type of a type literal typ…
Andarist Oct 28, 2024
2161893
fix paste edits range: include all completely selected identifiers (#…
iisaduan Oct 29, 2024
da15ef2
Fix a crash in an anonymous buffer that copilot is writing to. (#60377)
sandersn Oct 30, 2024
f478257
Remove unused `SymbolLinks["bindingElement"]` (#60385)
Andarist Oct 31, 2024
a271797
Use `canHaveFlowNode` in `checkIfExpressionRefinesParameter` (#58816)
Andarist Oct 31, 2024
48f2ada
Add string literal completions for `package.json` `imports` field (#5…
Andarist Oct 31, 2024
e4dc78a
Fixed crash on class member completions with auto imports from merged…
Andarist Oct 31, 2024
32513a7
Fixed an accidental `undefined` leak into `getAccessibleSymbolChain`'…
Andarist Oct 31, 2024
3e61718
fix autoimports crash: generate namespace and other module symbol imp…
iisaduan Nov 1, 2024
248c8f5
Fix incorrect details in lib.decorators (#60252)
trusktr Nov 1, 2024
11b2930
Add compatible overloads that accept ArrayBuffer to BigInt64Array/Big…
rbuckton Nov 1, 2024
0ec4d30
Fixing exception on unsaved file (#60362)
navya9singh Nov 3, 2024
c09e2ab
Fixed syntactic nullisness semantics for comma expressions (#60402)
Andarist Nov 4, 2024
131f673
Bump version to 5.8. (#60422)
DanielRosenwasser Nov 5, 2024
82a04b2
Fix false positive rewriteRelativeImportExtensions error on non-TS ex…
andrewbranch Nov 5, 2024
9d7e087
Remove cancellationToken.js (#60250)
jakebailey Nov 5, 2024
80eeb4e
Proposed expandable hover API (#59940)
gabritto Nov 6, 2024
60dd512
fix(60223): add Promise.try() to ESNext lib (#60232)
dirkluijk Nov 6, 2024
8d95ac5
Fix `getEffectiveCheckNode` (#60309)
gabritto Nov 6, 2024
5e2e321
Reuse cached resolved signatures early (#60208)
Andarist Nov 6, 2024
30979c2
Narrow generic conditional and indexed access return types when check…
gabritto Nov 6, 2024
55f1248
MetaProperty is possibly nullish (#60440)
RyanCavanaugh Nov 6, 2024
ef802b1
feat(60312): Add missing properties for satisfies (#60314)
a-tarasyuk Nov 8, 2024
b58ac4a
Extract function types from function and arrow expressions. (#60234)
dragomirtitian Nov 11, 2024
79ea5a5
Stub out copilotRelated command (#60488)
sandersn Nov 13, 2024
c043944
Let isolated declarations fixer add toplevel imports more (#60267)
benjaminjkraft Nov 13, 2024
b3c67d3
Move to file: fix detection of references to globals that shouldn't b…
andrewbranch Nov 15, 2024
d6b7c41
fix(60505): Convert to namespace import refactoring should drop file …
a-tarasyuk Nov 20, 2024
d85767a
fix(60484): Implementing a prim type in a class expression should rep…
a-tarasyuk Nov 20, 2024
ee0e08b
Bump the github-actions group across 1 directory with 2 updates (#60581)
dependabot[bot] Nov 25, 2024
96410eb
fix missing react error with fragments in `react-native` (#60615)
iisaduan Nov 26, 2024
9fe6c36
Fixed syntactic nullisness semantics for tagged template expressions …
Andarist Nov 26, 2024
b263cc4
Improve the definition of atan2() (#60493)
Psychpsyo Nov 27, 2024
9717772
Allow assignments to readonly class properties within IIFEs contained…
Andarist Dec 2, 2024
14c65b3
Check if switch statements are exhaustive when their expressions is g…
Andarist Dec 2, 2024
ac24ab7
Merge remote-tracking branch 'origin/main' into bug/57553-resolve-con…
Andarist Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(60223): add Promise.try() to ESNext lib (microsoft#60232)
  • Loading branch information
dirkluijk authored Nov 6, 2024
commit 60dd512a830600cbd8821ee8ece2bb544868f3ea
1 change: 1 addition & 0 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ const libEntries: [string, string][] = [
["esnext.regexp", "lib.es2024.regexp.d.ts"],
["esnext.string", "lib.es2024.string.d.ts"],
["esnext.iterator", "lib.esnext.iterator.d.ts"],
["esnext.promise", "lib.esnext.promise.d.ts"],
["decorators", "lib.decorators.d.ts"],
["decorators.legacy", "lib.decorators.legacy.d.ts"],
];
Expand Down
1 change: 1 addition & 0 deletions src/lib/esnext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/// <reference lib="esnext.collection" />
/// <reference lib="esnext.array" />
/// <reference lib="esnext.iterator" />
/// <reference lib="esnext.promise" />
16 changes: 16 additions & 0 deletions src/lib/esnext.promise.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
interface PromiseConstructor {
/**
* Takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result
* in a Promise.
*
* @param callbackFn A function that is called synchronously. It can do anything: either return
* a value, throw an error, or return a promise.
* @param args Additional arguments, that will be passed to the callback.
*
* @returns A Promise that is:
* - Already fulfilled, if the callback synchronously returns a value.
* - Already rejected, if the callback synchronously throws an error.
* - Asynchronously fulfilled or rejected, if the callback returns a promise.
*/
try<T, U extends unknown[]>(callbackFn: (...args: U) => T | PromiseLike<T>, ...args: U): Promise<Awaited<T>>;
}
1 change: 1 addition & 0 deletions src/lib/libs.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"esnext.collection",
"esnext.array",
"esnext.iterator",
"esnext.promise",
"decorators",
"decorators.legacy",
// Default libraries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,19 @@
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/iterator' was not resolved. ========",
"======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.",
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: JavaScript.",
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/promise' was not resolved. ========",
"======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,21 @@
"======== Module name '@typescript/lib-esnext/iterator' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.",
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: JavaScript.",
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/promise' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
Expand Down
12 changes: 12 additions & 0 deletions tests/baselines/reference/modulePreserve2.trace.json
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,18 @@
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/iterator' was not resolved. ========",
"======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.",
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: JavaScript.",
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/promise' was not resolved. ========",
"======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
Expand Down
11 changes: 11 additions & 0 deletions tests/baselines/reference/modulePreserve3.trace.json
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,17 @@
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/iterator' was not resolved. ========",
"======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.",
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: JavaScript.",
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/promise' was not resolved. ========",
"======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,20 @@
"======== Module name '@typescript/lib-esnext/iterator' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.",
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: JavaScript.",
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/promise' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,21 @@
"======== Module name '@typescript/lib-esnext/iterator' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.",
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: JavaScript.",
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/.src/node_modules' does not exist, skipping all lookups in it.",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/promise' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,20 @@
"======== Module name '@typescript/lib-esnext/iterator' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.",
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.",
"Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"Scoped package detected, looking in 'typescript__lib-esnext/promise'",
"Loading module '@typescript/lib-esnext/promise' from 'node_modules' folder, target file types: JavaScript.",
"Searching all ancestor node_modules directories for fallback extensions: JavaScript.",
"Directory '/node_modules' does not exist, skipping all lookups in it.",
"======== Module name '@typescript/lib-esnext/promise' was not resolved. ========",
"File '/.ts/package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
"Explicitly specified module resolution kind: 'Node10'.",
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
Expand Down
64 changes: 64 additions & 0 deletions tests/baselines/reference/promiseTry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//// [tests/cases/compiler/promiseTry.ts] ////

//// [promiseTry.ts]
Promise.try(() => {
return "Sync result";
});

Promise.try(async () => {
return "Async result";
});

const a = Promise.try(() => "Sync result");
const b = Promise.try(async () => "Async result");

// SINGLE PARAMETER
Promise.try((foo: string) => "Async result", "foo");
Promise.try((foo) => "Async result", "foo");
// @ts-expect-error too few parameters
Promise.try((foo) => "Async result");
Promise.try((foo: string | undefined) => "Async result", undefined);
Promise.try((foo: string | undefined) => "Async result", "foo");
Promise.try((foo) => "Async result", undefined);
// @ts-expect-error too many parameters
Promise.try(() => "Async result", "foo");

// MULTIPLE PARAMETERS
Promise.try((foo: string, bar: number) => "Async result", "foo", 42);
// @ts-expect-error too many parameters
Promise.try((foo: string, bar: number) => "Async result", "foo", 42, "baz");
// @ts-expect-error too few parameters
Promise.try((foo: string, bar: number) => "Async result", "foo");
Promise.try((foo: string, bar?: number) => "Async result", "foo");
Promise.try((foo: string, bar?: number) => "Async result", "foo", undefined);
Promise.try((foo: string, bar?: number) => "Async result", "foo", 42);


//// [promiseTry.js]
Promise.try(() => {
return "Sync result";
});
Promise.try(async () => {
return "Async result";
});
const a = Promise.try(() => "Sync result");
const b = Promise.try(async () => "Async result");
// SINGLE PARAMETER
Promise.try((foo) => "Async result", "foo");
Promise.try((foo) => "Async result", "foo");
// @ts-expect-error too few parameters
Promise.try((foo) => "Async result");
Promise.try((foo) => "Async result", undefined);
Promise.try((foo) => "Async result", "foo");
Promise.try((foo) => "Async result", undefined);
// @ts-expect-error too many parameters
Promise.try(() => "Async result", "foo");
// MULTIPLE PARAMETERS
Promise.try((foo, bar) => "Async result", "foo", 42);
// @ts-expect-error too many parameters
Promise.try((foo, bar) => "Async result", "foo", 42, "baz");
// @ts-expect-error too few parameters
Promise.try((foo, bar) => "Async result", "foo");
Promise.try((foo, bar) => "Async result", "foo");
Promise.try((foo, bar) => "Async result", "foo", undefined);
Promise.try((foo, bar) => "Async result", "foo", 42);
Loading