Problem with properties of type 'any'
Closed this issue · 4 comments
drewwiens commented
I have been unable to access children of properties that have type 'any':
Property does not exist on type 'OCType'.
Property does not exist on type 'IDataAccessor'.
dereklin commented
It will be good if it can be fixed. In the meantime, maybe you can use this workaround?:
import { oc } from 'ts-optchain';
const testVar: {a: any} = { a: { b: 'some value', c: 'hi' } };
const a: any = oc(testVar).a;
console.log(a.b());
https://stackblitz.com/edit/ts-optchain-any-aawyvi?file=index.ts
wouterds commented
I quickly tried this out (#28), working as expected. Looking forward to a release where this is included!
wielrls commented
released!