Skip to content

[async] Cannot read property 'members' of undefined #3978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nippur72 opened this issue Jul 22, 2015 · 7 comments
Closed

[async] Cannot read property 'members' of undefined #3978

nippur72 opened this issue Jul 22, 2015 · 7 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@nippur72
Copy link

when compiling this code for ES5 (not ES6)

async function f() {
   return { };  
}

instead of giving the "only available in ES6" warning, it throws this exception:

               throw e;
                     ^
TypeError: Cannot read property 'members' of undefined
   at resolveDeclaredMembers (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:15429:65)
   at resolveTypeReferenceMembers (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:15459:26)
   at resolveStructuredTypeMembers (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:15665:21)
   at getPropertiesOfObjectType (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:15673:24)
   at propertiesRelatedTo (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:17141:34)
   at objectTypeRelatedTo (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:17107:30)
   at isRelatedTo (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:16935:34)
   at checkTypeRelatedTo (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:16824:26)
   at checkTypeAssignableTo (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:16797:20)
   at isTypeAssignableTo (C:\Users\Nino\AppData\Roaming\npm\node_modules\typescript\bin\tsc.js:16791:20)

using tsc 1.5.3

@rbuckton
Copy link
Contributor

rbuckton commented Aug 4, 2015

@nippur72: TypeScript 1.5.3 does not contain support for Async Functions, and I cannot seem to repro this in master. It's possible a recent unrelated change may have fixed this. Is it possible you were using a different version of the compiler than the one you mentioned above? Can you verify the version of the compiler you are using, or possibly verify this against a recent nightly build?

@mhegazy
Copy link
Contributor

mhegazy commented Aug 4, 2015

@nippur72 can you try using latest `typescript@next?

@nippur72
Copy link
Author

nippur72 commented Aug 5, 2015

@mhegazy @rbuckton I've checked with typescript@next and the bug is gone, so I'm closing this.

(P.S. I was sure it was 1.5.3, but as you've said it couldn't be, so more likely I had something greater than 1.5.3).

@nippur72 nippur72 closed this as completed Aug 5, 2015
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Aug 5, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Aug 5, 2015

thanks @nippur72 for confirming.

@jsen-
Copy link

jsen- commented Aug 20, 2015

I think the issue is not yet gone.

I'm using typescript 1.6.0-dev.20150819 with experimentalAsyncFunctions enabled, targetting es6

The following code seems to trigger the error:

async function abcd() {
    console.log('abcd');
}
abcd().then(() => {
    console.log('then');
});

or

async function abcd() {
    console.log('abcd');
}
async function runAbcd() {
    await abcd();
}
runAbcd();

The following compiles (unfortunately there's no awaiting mechanism):

async function abcd() {
    console.log('abcd');
}
abcd();
D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:35252
                throw e;
                ^

TypeError: Cannot read property 'members' of undefined
    at resolveDeclaredMembers (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:15607:65)
    at resolveTypeReferenceMembers (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:15637:26)
    at resolveStructuredTypeMembers (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:15870:21)
    at getPropertyOfType (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:16002:32)
    at checkPropertyAccessExpressionOrQualifiedName (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:19993:24)
    at checkPropertyAccessExpression (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:19978:20)
    at checkExpressionWorker (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:22117:28)
    at checkExpression (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:22068:42)
    at resolveCallExpression (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:20919:28)
    at getResolvedSignature (D:\projects\sach\node_modules\electrolyte\node_modules\typescript\lib\typescript.js:21088:47)

iojs versions:

{ http_parser: '2.5.0',
  node: '3.0.0',
  v8: '4.4.63.26',
  uv: '1.6.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  modules: '45',
  openssl: '1.0.2d' }

@nippur72
Copy link
Author

Yes the issue is back, I re-discovered it yesterday in 1.6 nightly, so I'm reopening it.

@rbuckton
Copy link
Contributor

This is now fixed for 1.6.

@rbuckton rbuckton added the Fixed A PR has been merged for this issue label Aug 28, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants