-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Description
TypeScript Version: 3.7.2
Search Terms:
- Promise.all typing
Code
index.ts
type RandomType = {};
const getRandomValue = async (): Promise<RandomType> => {
return {};
};
const getResults = async (): Promise<{ data: string[] }> => {
return { data: ['a', 'b', 'c'] };
};
const run = async () => {
const [random, { data }] = await Promise.all([getRandomValue(), getResults()]);
console.log(random, data);
};
run();
tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"lib": ["esnext", "dom"]
},
"exclude": ["node_modules"],
"include": ["./**/*.ts"]
}
Expected behavior:
Compiles successfully.
Actual behavior:
Compile error: "Property 'data' does not exist on type 'RandomType'."
Seems to still compile the js file even though it shows a compile error.
Does not run with ts-node
though.
Playground Link:
http://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=13&pc=31#
Related Issues:
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdFix AvailableA PR has been opened for this issueA PR has been opened for this issue