Comments (4)
Hm, I think this one might be because Promise
isn't defined in the lib transpileDeclaration
uses, and async
functions always have to Promise
-wrap their returns (so it's not like the cast type node is usable without modification). On the other hand, the missing Promise
type probably only matters because we don't have the logic to syntactically promise-wrap a cast's type node when the function is async.
@dragomirtitian thoughts? Technically, syntactically promise wrapping the cast node isn't fully correct, since if the cast is to another promise type, you should unwrap it and then promise wrap that unwrapped thing (as MyPromise
should become a Promise<something>
return type)... So in that respect, there should be an ID error for this.
from typescript.
I think there's something fishy with the Workbench tool. Even without any promise wrapping, even on TS 5.4, the workbench DTS output pane incorrect states unknown
despite the hover-completion correctly showing the return type as Promise<number>
.
// @declaration: true
// @showEmit
// @showEmittedFile: a.d.ts
// @filename: a.ts
export async function foo() {
return 42;
}
a.d.ts
as reported by Workbench output pane:
export declare function foo(): unknown;
from typescript.
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in the issue body running against the nightly TypeScript.
Issue body code block by @MichaelMitchell-at
👍 Compiled
Emit:
export declare function foo(): Promise<number>;
Historical Information
Version | Reproduction Outputs |
---|---|
5.0.2, 5.1.3, 5.2.2, 5.3.2, 5.4.2 |
👍 Compiled export declare function foo(): Promise<number>; |
from typescript.
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of this repro running against the nightly TypeScript.
👍 Compiled
Emit:
export declare function foo(): Promise<number>;
Historical Information
Version | Reproduction Outputs |
---|---|
5.0.2, 5.1.3, 5.2.2, 5.3.2, 5.4.2 |
👍 Compiled export declare function foo(): Promise<number>; |
from typescript.
Related Issues (20)
- Seeking Guidance: Significant typecheck performance drop post migrating to TS Project References in large monorepo HOT 9
- Inconsistent function argument type inference based on result assignment way HOT 3
- d.ts file doesn't have ///<reference types=""/> after updating typescript to v5.5.4 HOT 2
- Type guard fails to determine non null tuple property HOT 1
- Type discrimination bug with string literal tuple. HOT 4
- Native node TestContext.assert is not typed correctly HOT 6
- `"importHelpers": true` combined with `"module": "preserve"` results in undefined helper usage HOT 6
- Variance annotations in type aliases for interfaces do not affect assignability HOT 2
- Array.forEach args type error HOT 10
- `@deprecated` nested namespace handling is buggy HOT 2
- JSDoc @import statement for side effects HOT 5
- Alias import is moved incorrectly when moving code to another file HOT 2
- Import named `Disposable` is not moved when moving code to another file HOT 1
- Find all references in TS is off by 1 line in this specific case HOT 4
- TS2454 Variable is used before being assigned with strictNullChecks when variable is clearly assigned but can be undefined
- Type PermissionName for Permission API doesn't contain microphone and camera devices HOT 2
- RangeError in Array destructuring assignment HOT 3
- Library method redefinition stopped working from 5.4 to 5.5 HOT 3
- Design Meeting Notes, 8/30/2024
- `this` becomes any inside function within object when using generic method types that `extends` + syntax highlighting breaks HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.