GithubHelp home page GithubHelp logo

ts-deep-extract-types's Introduction

This packages exposes types that allow you to extract deeply nested types.

type DeepExtractTypeSkipArrays<Source, Path extends [...string[]]>

Extracts a deeply-nested type from the target Path in Source, skipping arrays and ignoring null|undefined|optional types:

type QueryResult = { allPosts?: Array<{ users?: Array<{ name: string }> }> };
// will be { name: string }
type User = DeepExtractTypeSkipArrays<QueryResult, ["allPosts", "users"]>;

type DeepExtractType<Source, Path extends [...(string | number)[]]>

Extracts a deeply-nested type from the target Path in Source, ignoring null|undefined|optional types:

type QueryResult = { user?: { firstPost?: { title: string } } };
// will be { title: string }
type Post = DeepExtractType<QueryResult, ["user", "firstPost"]>;

ts-deep-extract-types's People

Contributors

phryneas avatar

Stargazers

Ben Puckhaber avatar Mert Ciflikli avatar  avatar Stefano Cerelli avatar Marek Sokol avatar GAURAV avatar Arden de Raaij avatar Lars Ejaas avatar Alexander avatar Scott Wey avatar Kit Whittaker avatar  avatar Vlad Sazonau avatar Fosty Fost avatar Chris Lewis avatar Raja Jaganathan avatar Jaime Oliveira avatar Johannes Hoppe avatar Son Tran avatar Gerard del Castillo avatar Ryan C avatar  avatar Bryan Müller avatar Timon van Spronsen avatar Abhijith Vijayan avatar Robert Cooper avatar Mathieu Breton avatar Martin Zlámal avatar Luís Rodrigues avatar Julien Karst  avatar Toan Tran avatar Jaewon avatar Sibelius Seraphini avatar Ashwin Bhat avatar Monir Abu Hilal avatar Grégory Houllier avatar Julien Goux avatar Dohyung Ahn avatar Hyeseong Kim avatar Jason Brown avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Forkers

icodein

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.