Code
====

```js
const test = {
  a: 'b',
  c: 'd',
} as const;

const toPick: string = 'a';

if (toPick in test) {
  console.log(test[toPick]); // not "b" (Error)
}

```

without `as const` also Error

### Error

> 
> Element implicitly has an 'any' type because expression of type
> 'string' can't be used to index type `'{ readonly a: "b"; readonly c: "d"; }'`.
> 
> 
> 

> 
> No index signature with a parameter of type 'string' was found on
> type `'{ readonly a: "b"; readonly c: "d"; }'`.
> 
> 
> 

[typescript playground](https://www.typescriptlang.org/play?#code/MYewdgzgLgBFCm0YF4YG8CwAoGMCGAXDAOQBGxANNrsEcQCaXYC++EMokUA3Ntp0iggACgEtgAayLQATqLABzFCTzFeWbKIBmMABRCxkmPLiIoASnTUO4CCAA28AHT2QC-WYDaB8RIC65twwAPTBMGAgsABEpFEs2EA)