# instructions 1. Clone the typescript repo (tips: `git clone --depth=`, otherwise takes forever). Modify `checker.ts`, mainly involve the `getConditionalType()` function, see attached file below. I apply my mod to commit `ba5e86f1406f39e89d56d4b32fd6ff8de09a0bf3`, mind the difference of line number if you cloned a different revision. Then follow the repo's readme to compile a custom build. 2. Download the `tool.js` file, then `node --inspect` to start a interactive shell. I recommend using the [nodejs-v8-inspector-manager](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj) chrome extension to view result inside web console instead of terminal for readability. read on for usage example. # usage example in node interactive shell Take for example the attached `demo.ts` file. ``` const checkAgainst = require('./tool.js'); var results = checkAgainst('/path/to/demo.ts', 171 /* position of `shouldBeNull` in `demo.ts` */, {}); var result = results.pop() ``` ## result explained Now if you checkout `result` in console, you'll see it's basically a nested array that goes like: `[ [number, number, boolean], boolean, null ]` I made this array a tuple of `[checkType, extendsType, trueType, falseType, bothTrueAndFalseType, undeterminedConditionalType]`. If encountered a nested tuple, that means there's another chained conditional type resolution happening along the way. (For detail, look for `pushTop()` in attached `checker_mod.ts`.) So the above result explained in plain english: 1. the conditionalTypeA's checkType is another conditionalTypeB 2. conditionalTypeB's checkType is `number`, it checks agains extendsType `number` and resolves to trueType `boolean` 3. that make conditionalTypeA's checkType to be `boolean`, it checks agains extendsType `boolean` and resolves to trueType `null` --- this is part of an answer to stack overflow question: https://stackoverflow.com/questions/58565584/how-can-i-see-how-typescript-computes-types