Skip to content

TypeScript error "has no index signature" starting instance

Hi, I'm getting a typescript error that I'm having trouble resolving. Specifically I'm getting these errors at startup:

TSError: ⨯ Unable to compile TypeScript:
src/upload.ts(85,62): error TS7017: Element implicitly has an 'any' type because type '{ '/': string; _: string; '+': string; '-': string; '=': string; '.': string; }' has no index signature.
src/upload.ts(155,23): error TS7017: Element implicitly has an 'any' type because type '{ name: string; reputation: number; }' has no index signature.

The first one I resolved. The second one I'm having more of a problem with:

account[type].account_auths.forEach((key: string[]) => {

And the type checker fails because it doesn't understand account['posting'|'active'|'owner'].

I have tried the v8, v10, and v12 LTS versions of Node, and none of them work. Is there some requirement I'm not satisfying? Seems odd that only I would be having these problems.

OS: 18.04.5 LTS (GNU/Linux 4.15.0-153-generic x86_64)

Steps to reproduce:

  1. Clone repo
  2. Enable NVM to use node v10.24.1 (Dubnium LTS)
  3. Add this file to imagehoster/src/types/hivesigner/index.d.ts: declare module 'hivesigner';
  4. Run make devserver
  5. See errors in console.
Edited by Shawn Lauzon