Using Promise as return type in FlowFlow Types with Promises (Fetch's)Get the name of an object's typeevent.preventDefault() vs. return falseWhy does ++[[]][+[]]+[+[]] return the string “10”?How do I return the response from an asynchronous call?declaration of flow (flowtype) generic typeError: Flow: WeakMap. Application of polymorphic type needs <list of 2 arguments>. (Can use `*` for inferrable ones)Flow errors on PromisesFlow type return type for async stringFlow does keeps interpreting variables as Promises after async/awaitMomentjs and Flow types

Planar regular languages

Write a function that returns an iterable object of all valid points 4-directionally adjacent to (x, y)

Why did it become so much more expensive to start a university?

Were Roman public roads build by private companies?

Telling my mother that I have anorexia without panicking her

Thematic, genred concepts in Ancient Greek?

How do EVA suits manage water excretion?

Has SHA256 been broken by Treadwell Stanton DuPont?

What organs or modifications would be needed for a life biological creature not to require sleep?

Asked to Not Use Transactions and to Use A Workaround to Simulate One

Why don't Wizards use wrist straps to protect against disarming charms?

Parallel resistance in electric circuits

What explanation do proponents of a Scotland-NI bridge give for it breaking Brexit impasse?

Is low emotional intelligence associated with right-wing and prejudiced attitudes?

Why is this weapon searching for a new owner?

What are uses of the byte after BRK instruction on 6502?

"Literally" Vs "In the true sense of the word"

Newly created XFS filesystem shows 78 GB used

The Planck constant for mathematicians

Why is the T-1000 humanoid?

What officially disallows US presidents from driving?

Some Prime Peerage

My research paper filed as a patent in China by my Chinese supervisor without me as inventor

Sort files in a given folders and provide as a list



Using Promise as return type in Flow


Flow Types with Promises (Fetch's)Get the name of an object's typeevent.preventDefault() vs. return falseWhy does ++[[]][+[]]+[+[]] return the string “10”?How do I return the response from an asynchronous call?declaration of flow (flowtype) generic typeError: Flow: WeakMap. Application of polymorphic type needs <list of 2 arguments>. (Can use `*` for inferrable ones)Flow errors on PromisesFlow type return type for async stringFlow does keeps interpreting variables as Promises after async/awaitMomentjs and Flow types






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








24















I'm using Flow 0.30.0. I have a function that returns a promise:



function process(callback:Function):Promise 
return new Promise((r,re) => callback)



Flow raises an error, complaining:



function process(callback:Function):Promise {
^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)


This works in Try Flow, but not locally. Any ideas of the issue?










share|improve this question
































    24















    I'm using Flow 0.30.0. I have a function that returns a promise:



    function process(callback:Function):Promise 
    return new Promise((r,re) => callback)



    Flow raises an error, complaining:



    function process(callback:Function):Promise {
    ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)


    This works in Try Flow, but not locally. Any ideas of the issue?










    share|improve this question




























      24












      24








      24








      I'm using Flow 0.30.0. I have a function that returns a promise:



      function process(callback:Function):Promise 
      return new Promise((r,re) => callback)



      Flow raises an error, complaining:



      function process(callback:Function):Promise {
      ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)


      This works in Try Flow, but not locally. Any ideas of the issue?










      share|improve this question
















      I'm using Flow 0.30.0. I have a function that returns a promise:



      function process(callback:Function):Promise 
      return new Promise((r,re) => callback)



      Flow raises an error, complaining:



      function process(callback:Function):Promise {
      ^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)


      This works in Try Flow, but not locally. Any ideas of the issue?







      javascript flowtype






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 20 '18 at 19:10









      Rory O'Kane

      19.9k8 gold badges68 silver badges110 bronze badges




      19.9k8 gold badges68 silver badges110 bronze badges










      asked Aug 2 '16 at 21:20









      Allyl IsocyanateAllyl Isocyanate

      6,76413 gold badges56 silver badges108 bronze badges




      6,76413 gold badges56 silver badges108 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          37
















          According to the flow changelog there was a change introduced in v0.28.0 which made type arguments explicit. Explicitly setting the return type to Promise<any> should fix your issue.



          Alternatively you can set the following flag to false, although this is a temporary flag which will be removed in the future



          experimental.strict_type_args=false



          https://github.com/facebook/flow/blob/master/Changelog.md#v0280






          share|improve this answer




















          • 4





            Excuse my ignorance but I've been trying to find the Promise type documentation in Flow Docs (flow.org/en/docs/types) but I couldn't find anything. Where is it documented?

            – Leonardo
            Sep 13 '17 at 23:23











          • @Leonardo I am in the same situation, have you found the docs on it?

            – Noitidart
            Sep 18 '17 at 5:52






          • 1





            @Noitidart kind of, I had to open an issue on github where they pointed me to the code implementing the Promise Type. Apparently the code exists but it's not documented :

            – Leonardo
            Sep 20 '17 at 9:27



















          0
















          I'm guessing this was figured some time ago and the correct answer to what was going on was that it was a versions mismatch between local and the on-line flow interpreter.



          However, as this question turns up near the top of search results when looking for how to Flow annotate Promises, it's probably worth mentioning that the fix for these types of situations is to specify the Flow type that the Promise resolves to as a Flow angle bracket parameter.



          In this case adding a "any" to the Promise annotation silences the error e.g. ...



          function process(callback:Function):Promise<any> 
          return new Promise((r,re) => callback)



          In the docs over here as well for another example






          share|improve this answer





























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38730646%2fusing-promise-as-return-type-in-flow%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            37
















            According to the flow changelog there was a change introduced in v0.28.0 which made type arguments explicit. Explicitly setting the return type to Promise<any> should fix your issue.



            Alternatively you can set the following flag to false, although this is a temporary flag which will be removed in the future



            experimental.strict_type_args=false



            https://github.com/facebook/flow/blob/master/Changelog.md#v0280






            share|improve this answer




















            • 4





              Excuse my ignorance but I've been trying to find the Promise type documentation in Flow Docs (flow.org/en/docs/types) but I couldn't find anything. Where is it documented?

              – Leonardo
              Sep 13 '17 at 23:23











            • @Leonardo I am in the same situation, have you found the docs on it?

              – Noitidart
              Sep 18 '17 at 5:52






            • 1





              @Noitidart kind of, I had to open an issue on github where they pointed me to the code implementing the Promise Type. Apparently the code exists but it's not documented :

              – Leonardo
              Sep 20 '17 at 9:27
















            37
















            According to the flow changelog there was a change introduced in v0.28.0 which made type arguments explicit. Explicitly setting the return type to Promise<any> should fix your issue.



            Alternatively you can set the following flag to false, although this is a temporary flag which will be removed in the future



            experimental.strict_type_args=false



            https://github.com/facebook/flow/blob/master/Changelog.md#v0280






            share|improve this answer




















            • 4





              Excuse my ignorance but I've been trying to find the Promise type documentation in Flow Docs (flow.org/en/docs/types) but I couldn't find anything. Where is it documented?

              – Leonardo
              Sep 13 '17 at 23:23











            • @Leonardo I am in the same situation, have you found the docs on it?

              – Noitidart
              Sep 18 '17 at 5:52






            • 1





              @Noitidart kind of, I had to open an issue on github where they pointed me to the code implementing the Promise Type. Apparently the code exists but it's not documented :

              – Leonardo
              Sep 20 '17 at 9:27














            37














            37










            37









            According to the flow changelog there was a change introduced in v0.28.0 which made type arguments explicit. Explicitly setting the return type to Promise<any> should fix your issue.



            Alternatively you can set the following flag to false, although this is a temporary flag which will be removed in the future



            experimental.strict_type_args=false



            https://github.com/facebook/flow/blob/master/Changelog.md#v0280






            share|improve this answer













            According to the flow changelog there was a change introduced in v0.28.0 which made type arguments explicit. Explicitly setting the return type to Promise<any> should fix your issue.



            Alternatively you can set the following flag to false, although this is a temporary flag which will be removed in the future



            experimental.strict_type_args=false



            https://github.com/facebook/flow/blob/master/Changelog.md#v0280







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 2 '16 at 21:34









            mike dmike d

            7791 gold badge6 silver badges15 bronze badges




            7791 gold badge6 silver badges15 bronze badges










            • 4





              Excuse my ignorance but I've been trying to find the Promise type documentation in Flow Docs (flow.org/en/docs/types) but I couldn't find anything. Where is it documented?

              – Leonardo
              Sep 13 '17 at 23:23











            • @Leonardo I am in the same situation, have you found the docs on it?

              – Noitidart
              Sep 18 '17 at 5:52






            • 1





              @Noitidart kind of, I had to open an issue on github where they pointed me to the code implementing the Promise Type. Apparently the code exists but it's not documented :

              – Leonardo
              Sep 20 '17 at 9:27













            • 4





              Excuse my ignorance but I've been trying to find the Promise type documentation in Flow Docs (flow.org/en/docs/types) but I couldn't find anything. Where is it documented?

              – Leonardo
              Sep 13 '17 at 23:23











            • @Leonardo I am in the same situation, have you found the docs on it?

              – Noitidart
              Sep 18 '17 at 5:52






            • 1





              @Noitidart kind of, I had to open an issue on github where they pointed me to the code implementing the Promise Type. Apparently the code exists but it's not documented :

              – Leonardo
              Sep 20 '17 at 9:27








            4




            4





            Excuse my ignorance but I've been trying to find the Promise type documentation in Flow Docs (flow.org/en/docs/types) but I couldn't find anything. Where is it documented?

            – Leonardo
            Sep 13 '17 at 23:23





            Excuse my ignorance but I've been trying to find the Promise type documentation in Flow Docs (flow.org/en/docs/types) but I couldn't find anything. Where is it documented?

            – Leonardo
            Sep 13 '17 at 23:23













            @Leonardo I am in the same situation, have you found the docs on it?

            – Noitidart
            Sep 18 '17 at 5:52





            @Leonardo I am in the same situation, have you found the docs on it?

            – Noitidart
            Sep 18 '17 at 5:52




            1




            1





            @Noitidart kind of, I had to open an issue on github where they pointed me to the code implementing the Promise Type. Apparently the code exists but it's not documented :

            – Leonardo
            Sep 20 '17 at 9:27






            @Noitidart kind of, I had to open an issue on github where they pointed me to the code implementing the Promise Type. Apparently the code exists but it's not documented :

            – Leonardo
            Sep 20 '17 at 9:27














            0
















            I'm guessing this was figured some time ago and the correct answer to what was going on was that it was a versions mismatch between local and the on-line flow interpreter.



            However, as this question turns up near the top of search results when looking for how to Flow annotate Promises, it's probably worth mentioning that the fix for these types of situations is to specify the Flow type that the Promise resolves to as a Flow angle bracket parameter.



            In this case adding a "any" to the Promise annotation silences the error e.g. ...



            function process(callback:Function):Promise<any> 
            return new Promise((r,re) => callback)



            In the docs over here as well for another example






            share|improve this answer































              0
















              I'm guessing this was figured some time ago and the correct answer to what was going on was that it was a versions mismatch between local and the on-line flow interpreter.



              However, as this question turns up near the top of search results when looking for how to Flow annotate Promises, it's probably worth mentioning that the fix for these types of situations is to specify the Flow type that the Promise resolves to as a Flow angle bracket parameter.



              In this case adding a "any" to the Promise annotation silences the error e.g. ...



              function process(callback:Function):Promise<any> 
              return new Promise((r,re) => callback)



              In the docs over here as well for another example






              share|improve this answer





























                0














                0










                0









                I'm guessing this was figured some time ago and the correct answer to what was going on was that it was a versions mismatch between local and the on-line flow interpreter.



                However, as this question turns up near the top of search results when looking for how to Flow annotate Promises, it's probably worth mentioning that the fix for these types of situations is to specify the Flow type that the Promise resolves to as a Flow angle bracket parameter.



                In this case adding a "any" to the Promise annotation silences the error e.g. ...



                function process(callback:Function):Promise<any> 
                return new Promise((r,re) => callback)



                In the docs over here as well for another example






                share|improve this answer















                I'm guessing this was figured some time ago and the correct answer to what was going on was that it was a versions mismatch between local and the on-line flow interpreter.



                However, as this question turns up near the top of search results when looking for how to Flow annotate Promises, it's probably worth mentioning that the fix for these types of situations is to specify the Flow type that the Promise resolves to as a Flow angle bracket parameter.



                In this case adding a "any" to the Promise annotation silences the error e.g. ...



                function process(callback:Function):Promise<any> 
                return new Promise((r,re) => callback)



                In the docs over here as well for another example







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 3 at 10:38

























                answered Mar 28 at 10:25









                shufflingbshufflingb

                516 bronze badges




                516 bronze badges































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38730646%2fusing-promise-as-return-type-in-flow%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현