question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type 'unknown' cannot be used as an index type

See original GitHub issue

Describe the bug In certain builds, when we try to run start.sh, the local stack fails to come up with the following error: Type ‘unknown’ cannot be used as an index type (in line 63 in WinnowingPreprocessingService.ts).

When @sophiewu6 tried running a local stack, this error prevented the stack from coming up, whereas I can bring my stack up fine. (We both use MacOS 10.14.5) I also see the same error in my Sublime Text editor (which has a Typescript compiler attached). So looks like the typescript error is not blocking my stack from coming up, but its blocking @sophiewu6’s stack.

To Reproduce Steps to reproduce the behavior: Merge upstream/develop Run bash scripts/start.sh

Observed behavior Local stack doesn’t come up

Expected behavior Local stack should come up

Screenshots 2019-06-12

Desktop (please complete the following information; delete this section if the issue does not arise on desktop):

  • OS: MacOS 10.14.5
  • Browser Chrome
  • Version 74.0.3729.169

Additional context Note: As a temporary fix for this problem you can change line 62 of WinnowingPreprocessingService.ts to fingerprintHashesIndex.forEach(function(hashIndex: number) {

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Sangeeth-Pereracommented, May 21, 2021

options[value as number] or options[value as any] should sort the issue

0reactions
mridul-netizencommented, May 31, 2022

Hey folks, if you’re running into issues somewhat like these, please look into the following points from the wiki https://github.com/oppia/oppia/wiki/Guide-on-defining-types#ts-8 https://github.com/oppia/oppia/wiki/Guide-on-defining-types/#ts-4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type cannot be used as an index type - Stack Overflow
You can't index an array using an object; you must use a number to represent the offset from the start of the array....
Read more >
Type 'X' cannot be used as an index type in TypeScript
The error "Type cannot be used as an index type" occurs when we try to use a type that cannot be used to...
Read more >
Documentation - Indexed Access Types - TypeScript
Indexed Access Types. We can use an indexed access type to look up a specific property on another type: ... Type 'key' cannot...
Read more >
Type 'String' cannot be used as an index type in Typescript
Type 'String' cannot be used as an index type in Typescript occurs when you use String (Starts with capital s ) instead of...
Read more >
Type 'undefined' cannot be used as an index type.ts(2538)
Best way to fix `Type 'undefined' cannot be used as an index type.ts(2538)`. I am using next-auth with TypeScript & I have this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found