Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

[Question] How to use "await" / "async" in Tiny Unity ?

Discussion in 'Project Tiny' started by osamansr2o1oo, Mar 31, 2019.

  1. osamansr2o1oo

    osamansr2o1oo

    Joined:
    Sep 10, 2015
    Posts:
    9
    Using them without upgradnig from ES5 gives an error that I don't know how to handle!

    Error msg:
    An async function or method in ES5/ES3 requires the 'Promise' constructor.  Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.


    I tried adding "tsconfig.override.json" to the root of my Tiny Project (i.e. besides the .utproject file) with
    "target": "ES2017" OR "target": "ES6" but it didn't work, I also tried "lib": ["es2018", "dom"] and still nothing.

    By nothing I mean I get a whole punch of errors saying Array,string,number,... not defined

    example on what i write inside the tsconfig.override.json file
    Code (JavaScript):
    1. {
    2. "compilerOptions": {
    3. "target": "ES2017"
    4. }
    5. }
    Lastly, I saw some examples on the forums using them when I search before posting the thread, but it didn't help as they were answering other questions using them and not emphasizing on them!
    Thanks.