Back to Type Challenges

README

questions/15260-hard-tree-path-array/README.md

latest1.5 KB
Original Source
<!--info-header-start--><h1>Tree path array </h1><blockquote><p>by Neil Richter <a href="https://github.com/noook" target="_blank">@noook</a></p></blockquote><p><a href="https://tsch.js.org/15260/play" target="_blank"></a> </p><!--info-header-end-->

Create a type Path that represents validates a possible path of a tree under the form of an array.

Related challenges:

ts
declare const example: {
    foo: {
        bar: {
            a: string;
        };
        baz: {
            b: number
            c: number
        }
    };
}

// Possible solutions: 
// []
// ['foo']
// ['foo', 'bar']
// ['foo', 'bar', 'a']
// ['foo', 'baz']
// ['foo', 'baz', 'b']
// ['foo', 'baz', 'c']
<!--info-footer-start-->

<a href="../../README.md" target="_blank"></a> <a href="https://tsch.js.org/15260/answer" target="_blank"></a> <a href="https://tsch.js.org/15260/solutions" target="_blank"></a> <!--info-footer-end-->