Coder Social home page Coder Social logo

Comments (2)

TkDodo avatar TkDodo commented on June 15, 2024 1

Not sure why but the issue goes away when removing async from this function (that doesn't have await in it anyway):
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgYygUwIYzQJQgV2wBoV0tcIIY9C04BfOAMyghDgCIABGDAOwDOvZAGsA9GWQwAtK1pQOAbgBQy5BEHxWVGtjgBeUpmx4dBbAAoE9AJQrlGAQE8+yZvlcxgGuCCcARLAwAGQgMABM0KAsbAC44AAVWEGABNAAeJBABAHN4oShgPhyGAD5EZTg4dBh8KD5E5NS0ADp0AQgAGwA3NCtfXPiOAAs0Ts6IDgY7ZXpVdU04Is6iiloDI3JdPoRKuBy0GASMdD5qczR4mINy7XPaIj2wLGGhsSZKDkeqiYioq5sN18ASCoT+0RsLRgoz4Fgs4UB+nK4Ra2RyNketnsCyEcAARlAMKJDtsNqhjGtLLsqgcjic0GdtgCgXdtt84M9oW88ScvntfpEoPFHC43NckRUqlUcfBwkENhgAO4YYDwPyBXhgwUxKEwuEIoEotEzPZVGp1Bpy3gqKr0TEmmVwAD6y1WGowG1dfEprXwaS1UXdMWUYjEUrgAD0APxqDS4p0EokiQ7ujaJ4n3bAtP1oANQIMzIA

I generally wouldn't mix async/await with promise chaining - choose one and stick with it :)

from router.

toteto avatar toteto commented on June 15, 2024

That solves it for now, but probably more devs will face this inconsistency. await Promise.resolve('foo') should be the same type as await Promise.resolve().then(() => 'foo), both should be Promise<string>.

Additional hint, was using previously version 1.17.4 and this behaviour was OK. The regression was done between this and 1.26.3

from router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.