ts-optchain
ts-optchain copied to clipboard
Optional Chaining for TypeScript
Install instruction to setup TypeScript Custom Code Transformer https://github.com/rimeto/ts-optchain#typescript-custom-code-transformer 1. Using `TTypescript` Bundle contains ``` /***/ "./node_modules/ts-optchain/dist/proxy/index.js": /*!******************************************************!*\ !*** ./node_modules/ts-optchain/dist/proxy/index.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module,...
Add note that you can use integrated into ts optional chain feature since 3.7
What I wrote: ``` const type = oc(questionSet).questions[initialQuestionId].type(); ``` Output after compilation with transformer (formatted for readability): ``` const type = questionSet != null && questionSet.questions != null && questionSet.questions.initialQuestionId...
``` ts class Test { public a: number = 1 private b: number = 2 } const t = new Test() oc(t).a oc(t).b(0) ``` gives: ``` Property 'b' does not...
now the binding has to be done manually: ``` oc(res).value.getNo().bind(oc(res.value))() ``` could this be done auto?
```typescript interface TaskModel { Name: string; Type: TaskType; Data: TaskData; } type TaskData = StaticData | DynamicData | RedundancyData; interface StaticData { Field: string; } oc(taskModel).Data.Field() // Field is not...
Hello there I'm trying to use your transformer to get simple output instead of nested proxy-objects, but I struggle with that error now: ``` Module build failed (from ./node_modules/ts-loader/index.js): TypeError:...
Even the example in index.d.ts comments doesn't compile: ```ts const x = oc({ c: [-100, 200, -300], }); x.c.map(e => e()) === [-100, 200, -300]; // ^ Property 'map' does...
Is there a way to replace `_.get()` with `ts-optchain` for the following use case? ```typescript const response = { headers: { "Content-Type": "application/json" } }; const contentType = _.get(response, "headers.Content-Type");...
Hi. This line: https://github.com/rimeto/ts-optchain/blob/734afe9c258e0cbd68b41178e445f21dc187281c/src/proxy/index.ts#L17 The essence is that oc() object cannot be currently returned as a Promise (see StackOverflow link below). So to work-around, I had to wrap the oc()...