microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.13k stars 12.5k forks source link

"TypeError: array is not iterable" in `getSuggestedLibForNonExistentProperty` #52334

Closed gabritto closed 1 year ago

gabritto commented 1 year ago

Found at https://github.com/microsoft/TypeScript/issues/52253#issuecomment-1383261962.

pubkey/rxdb

Req #1598 - completionInfo
    at contains (/typescript-5.0.0-dev.20230115/lib/tsserver.js:2826:21)
    at getSuggestedLibForNonExistentProperty (/typescript-5.0.0-dev.20230115/lib/tsserver.js:72354:50)
    at reportNonexistentProperty (/typescript-5.0.0-dev.20230115/lib/tsserver.js:72303:31)
    at checkPropertyAccessExpressionOrQualifiedName (/typescript-5.0.0-dev.20230115/lib/tsserver.js:72136:11)
    at checkPropertyAccessExpression (/typescript-5.0.0-dev.20230115/lib/tsserver.js:71927:94)
    at checkExpressionWorker (/typescript-5.0.0-dev.20230115/lib/tsserver.js:77122:16)
    at checkExpression (/typescript-5.0.0-dev.20230115/lib/tsserver.js:77047:32)
    at checkExpressionForMutableLocation (/typescript-5.0.0-dev.20230115/lib/tsserver.js:76810:18)
    at checkPropertyAssignment (/typescript-5.0.0-dev.20230115/lib/tsserver.js:76826:12)
    at checkObjectLiteral (/typescript-5.0.0-dev.20230115/lib/tsserver.js:71023:71)
    at checkExpressionWorker (/typescript-5.0.0-dev.20230115/lib/tsserver.js:77120:16)
    at checkExpression (/typescript-5.0.0-dev.20230115/lib/tsserver.js:77047:32)
    at checkExpressionWithContextualType (/typescript-5.0.0-dev.20230115/lib/tsserver.js:76703:18)
    at getSignatureApplicabilityError (/typescript-5.0.0-dev.20230115/lib/tsserver.js:73067:25)
    at chooseOverload (/typescript-5.0.0-dev.20230115/lib/tsserver.js:73525:13)
    at resolveCall (/typescript-5.0.0-dev.20230115/lib/tsserver.js:73384:16)
    at resolveCallExpression (/typescript-5.0.0-dev.20230115/lib/tsserver.js:73800:12)
    at resolveSignature (/typescript-5.0.0-dev.20230115/lib/tsserver.js:74183:16)
    at getResolvedSignature (/typescript-5.0.0-dev.20230115/lib/tsserver.js:74203:20)
    at getContextualTypeForArgumentAtIndex (/typescript-5.0.0-dev.20230115/lib/tsserver.js:70051:112)
    at getContextualTypeForArgument (/typescript-5.0.0-dev.20230115/lib/tsserver.js:70042:39)
    at getContextualType2 (/typescript-5.0.0-dev.20230115/lib/tsserver.js:70479:16)
    at getApparentTypeOfContextualType (/typescript-5.0.0-dev.20230115/lib/tsserver.js:70415:120)
    at getContextualTypeForObjectLiteralElement (/typescript-5.0.0-dev.20230115/lib/tsserver.js:70276:18)
    at getContextualType2 (/typescript-5.0.0-dev.20230115/lib/tsserver.js:70487:16)
    at Object.getContextualType (/typescript-5.0.0-dev.20230115/lib/tsserver.js:46825:14)
    at getContextualType (/typescript-5.0.0-dev.20230115/lib/tsserver.js:148459:19)
    at getCompletionData (/typescript-5.0.0-dev.20230115/lib/tsserver.js:148690:43)
    at Object.getCompletionsAtPosition (/typescript-5.0.0-dev.20230115/lib/tsserver.js:146977:26)
    at Object.getCompletionsAtPosition2 [as getCompletionsAtPosition] (/typescript-5.0.0-dev.20230115/lib/tsserver.js:134099:35)
    at IOSession.getCompletions (/typescript-5.0.0-dev.20230115/lib/tsserver.js:176530:54)
    at completionInfo (/typescript-5.0.0-dev.20230115/lib/tsserver.js:174929:43)
    at /typescript-5.0.0-dev.20230115/lib/tsserver.js:177294:69
    at IOSession.executeWithRequestId (/typescript-5.0.0-dev.20230115/lib/tsserver.js:177286:14)
    at IOSession.executeCommand (/typescript-5.0.0-dev.20230115/lib/tsserver.js:177294:29)
    at IOSession.onMessage (/typescript-5.0.0-dev.20230115/lib/tsserver.js:177336:51)
    at Interface.<anonymous> (/typescript-5.0.0-dev.20230115/lib/tsserver.js:178787:14)

That is a filtered view of the text. To see the raw error text, go to RepoResults3/pubkey.rxdb.rawError.txt in the artifact folder

Last few requests

```json {"seq":1595,"type":"request","command":"definitionAndBoundSpan","arguments":{"file":"@PROJECT_ROOT@/dist/es/rx-query.js","line":180,"offset":34}} {"seq":1596,"type":"request","command":"completionInfo","arguments":{"file":"@PROJECT_ROOT@/dist/es/rx-query.js","line":184,"offset":6,"includeExternalModuleExports":false,"includeInsertTextCompletions":true,"triggerKind":1}} {"seq":1597,"type":"request","command":"completionEntryDetails","arguments":{"file":"@PROJECT_ROOT@/dist/es/rx-query.js","line":184,"offset":6,"entryNames":["@abstract"]}} {"seq":1598,"type":"request","command":"completionInfo","arguments":{"file":"@PROJECT_ROOT@/dist/es/rx-query.js","line":188,"offset":11,"includeExternalModuleExports":false,"includeInsertTextCompletions":true,"triggerKind":1}} ```

Repro Steps

  1. git clone https://github.com/pubkey/rxdb --recurse-submodules
  2. In dir rxdb, run git reset --hard 2196f118285768022b7ca79f7931ecd4c94d1750
  3. Install packages (exact steps are below, but it might be easier to follow the repo readme)
    1. In dir rxdb/docs-src/files/logo, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    2. In dir rxdb/docs/files/files/logo, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    3. In dir rxdb/docs/files/logo, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    4. In dir rxdb/examples/angular, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    5. In dir rxdb/examples/electron, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    6. In dir rxdb/examples/flutter/javascript, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    7. In dir rxdb/examples/graphql, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    8. In dir rxdb/examples/ionic2, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    9. In dir rxdb/examples/node, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    10. In dir rxdb/examples/react-native, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    11. In dir rxdb/examples/react, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    12. In dir rxdb/examples/supabase, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    13. In dir rxdb/examples/svelte, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    14. In dir rxdb/examples/vanilla, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    15. In dir rxdb/examples/vite-vanilla-ts, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    16. In dir rxdb/examples/vue, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    17. In dir rxdb, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    18. In dir rxdb/plugins/attachments, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    19. In dir rxdb/plugins/backup, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    20. In dir rxdb/plugins/cleanup, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    21. In dir rxdb/plugins/crdt, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    22. In dir rxdb/plugins/dev-mode, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    23. In dir rxdb/plugins/electron, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    24. In dir rxdb/plugins/encryption, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    25. In dir rxdb/plugins/flutter, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    26. In dir rxdb/plugins/json-dump, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    27. In dir rxdb/plugins/key-compression, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    28. In dir rxdb/plugins/leader-election, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    29. In dir rxdb/plugins/local-documents, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    30. In dir rxdb/plugins/migration, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    31. In dir rxdb/plugins/query-builder, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    32. In dir rxdb/plugins/replication-couchdb-new, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    33. In dir rxdb/plugins/replication-couchdb, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    34. In dir rxdb/plugins/replication-firestore, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    35. In dir rxdb/plugins/replication-graphql, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    36. In dir rxdb/plugins/replication-p2p, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    37. In dir rxdb/plugins/replication-websocket, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    38. In dir rxdb/plugins/replication, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    39. In dir rxdb/plugins/server-couchdb, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    40. In dir rxdb/plugins/storage-dexie, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    41. In dir rxdb/plugins/storage-foundationdb, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    42. In dir rxdb/plugins/storage-lokijs, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    43. In dir rxdb/plugins/storage-memory, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    44. In dir rxdb/plugins/storage-remote-websocket, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    45. In dir rxdb/plugins/storage-remote, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    46. In dir rxdb/plugins/update, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    47. In dir rxdb/plugins/utils, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    48. In dir rxdb/plugins/validate-ajv, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    49. In dir rxdb/plugins/validate-is-my-json-valid, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    50. In dir rxdb/plugins/validate-z-schema, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
    51. In dir rxdb/test/tutorials, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
  4. Back in the initial folder, download RepoResults3/pubkey.rxdb.replay.txt from the artifact folder
  5. npm install --no-save @typescript/server-replay
  6. npx tsreplay ./rxdb ./pubkey.rxdb.replay.txt path/to/tsserver.js
  7. npx tsreplay --help to learn about helpful switches for debugging, logging, etc

gabritto commented 1 year ago

This reproduces under tsreplay --superSimple.