VSCode Extension & utilities for exploring TypeScript type information

Overview

ts-type-explorer

VSCode Extension & utilities to explore type information in TypeScript projects.

Installation

Check out the releases page to download the VSIX file.

Packages

Building

Build the entire project by running yarn build in the root directory, and build in watch-mode with yarn watch.

Contributing

See CONTRIBUTING.md!

Comments
  • Improved mapped type tests

    Improved mapped type tests

    Fixes #24

    As mentioned in #23 some types will not resolve and this still happens with this tests, as of now im not aware on how i could write the test properly to fail when the type is not resolved, i tried to go on the .tree but felt that i would break the entire test if trying to change it by hand.

    I also included the test mentioned in #25 so when custom depth is added this can be tested easily

    opened by Didas-git 3
  • Test Errors

    Test Errors

    As of now running tests on the lib will always result in 2 errors. This errors come from the module.ts file and are a result of how the tests are writen, i dont think this is a huge issue but at least one that should be mentioned on the contributing.md file.

    Error: Screenshot 2022-11-14 at 10 31 32

    bug tests 
    opened by Didas-git 1
  • Allow configurable recursion depth

    Allow configurable recursion depth

    Currently, the internal recursion depth is capped at 6, which makes cases like this one cause max recursion nodes.

    This depth number should be user-configurable.

    Thanks to @Didas-git for the example and suggestion!

    enhancement vscode api 
    opened by mxsdev 1
  • Test that ensures we don't import non-types from typescript

    Test that ensures we don't import non-types from typescript

    Sometimes the bundle fails in vscode because an extraneous dependency (typescript) is require'd, but is not included in the bundle.

    This can probably be accomplished with this eslint rule, but the vscode integration tests should 100% be using the bundled version rather than --extensionDevPath.

    vscode tests 
    opened by mxsdev 1
  • Improve Promise types

    Improve Promise types

    Currently one of the major problems is that Promises are shown as an object type and do not give you the return type upfront. My idea would be to use the <type arguments> to defined the promise type since it contains the proper type of the promise. image

    Another issue is that promises show a rather useless tag when looking into them image

    opened by Didas-git 1
  • Type tree gets generated on every quick info call

    Type tree gets generated on every quick info call

    The TypeInfo tree will be generated on every call to getQuickInfo on the typescript server. This can potentially cause enormous slowdowns on hovers in VSCode.

    Ideally, the tsserver plugin would generate a type tree only upon a quick info call originating from the extension.

    performance tsserver 
    opened by mxsdev 1
  • Max recursion depth tooltip

    Max recursion depth tooltip

    Max recursion depth tree items should say "Max recursion exceeded" or something like that on hover, instead of just ellipses.

    This will help users understand that this is not occurring due to an error.

    enhancement vscode 
    opened by mxsdev 0
  • Complex mapped types can break symbol resolution

    Complex mapped types can break symbol resolution

    Example:

    interface FieldVals {
        string: string;
        number: number
    }
    
    type FieldFormat = Record<string, keyof FieldVals>
    
    type MapField<T extends FieldFormat> = {
        [K in keyof T]: FieldVals[T[K]]
    }
    
    declare function createField<T extends FieldFormat>(data: T): MapField<T>
    
    const f = createField({a: "string"})
    
    f.a
    

    f.a in the extension will resolve to the symbol a which is of type "string", rather than following the resolution through to FieldVals, which should result in type string.

    Thanks to @Didas-git for reporting this/providing the example!

    bug api 
    opened by mxsdev 0
  • Hide internal symbols

    Hide internal symbols

    Some types have show internal symbols such as the following:

    image

    Ideally, these should be hidden by default.

    From #18 (thanks to @Didas-git for the suggestion!)

    enhancement api 
    opened by mxsdev 0
  • Show type arguments in description

    Show type arguments in description

    Would be nice to show type arguments in descriptions. So, for example, the following:

    image

    Would display Promise<void> instead of Promise.

    There should probably be a config option to toggle this feature, as well as a maximum length before going to ellipsis (e.g. Promise<...>.

    From #18 (thanks to @Didas-git for the suggestion!)

    enhancement vscode api 
    opened by mxsdev 0
  • Not getting jsdoc from declarations

    Not getting jsdoc from declarations

    For symbols defined with declare, the declaration is not included as a location, which prevents us from retrieving the jsdoc. For example, in the following, Button (which is defined with declare) will have no jsdoc.

    import React from "react"
    import { Button } from "@mui/material"
    
    export const Component: React.FunctionComponent = () => (
        <Button>Button</Button>
    )
    
    bug api 
    opened by mxsdev 0
  • Type parameters sometimes not resolved

    Type parameters sometimes not resolved

    In many circumstances, type parameters are not resolved, even if type arguments are. For example:

    declare function name(): Promise<void>;
    

    The return type here will show void as a type argument, but will not display T, the relevant type parameter.

    Thanks to @Didas-git for pointing this out!

    bug api 
    opened by mxsdev 0
  • Incompatible with Svelte Plugin

    Incompatible with Svelte Plugin

    Since the plugin now overrides completions, plugins which interface with completions, such as the svelte plugin, are incompatible, and can cause errors retrieving info.

    There's probably a few ways to approach solving this, like returning dummy info, or forcing extension load order somehow (by e.g. requiring the svelte extension as a dependency, if VSCode provides a way to do that).

    bug api low priority 
    opened by mxsdev 0
  • Filtering/Sorting

    Filtering/Sorting

    Might be nice to allow more complex filtering/sorting options.

    For example, sort by type kind, sort alphabetically, filter non-methods, etc.

    One challenge with doing this is finding a way to make it feel natural using the menu options provided by the Extension API. Not sure if there's actually a way to have, for example, a checkmark on a menu option.

    enhancement vscode low priority 
    opened by mxsdev 1
  • Union Types

    Union Types

    Currently, union types are kept as union types, with their constituent parts recursively merged. This is pretty much the best you could hope to do, although there are a few things you can do:

    • Distribute intersections over unions
    • Extract the "greatest common denominator" from the union

    The first example means, for example, {a: any} & ({b: any} | {c: any}) -> {a: any, b: any} | {a: any, c: any}. The second is the exact reverse of this.

    The most useful is probably the second, i.e., extracting the common factors out of the union, since this leaves the union members as small as possible.

    The problem of finding a gcd out of some objects, however, is kind of non-trivial, because there is some serious requisite recursive logic. For example:

    type t = 
      |{
        a: any,
        b: {
            x: any,
            y: any,
        }
      }
      |{
        c: any,
        b: {
            y: any,
            z: any
        }
      }
    

    would need to be converted to:

    type t =
      {
        b: {
          y: any
        }
      } & (
        |{
          a: any,
          b: {
            x: any
          }
        }
        |{
          c: any,
          b: {
            z: any
          }
        }
      )
    

    The recursive logic is manageable, however the problem really here is type comparison. For example, in the above example, we have to determine that b.y is equal in every element of the union. And I'm not sure whether it's possible to compare types like this using only externally exported methods from the typeChecker.

    enhancement help wanted api 
    opened by mxsdev 0
Releases(v0.4.0)
Owner
Max Stoumen
Max Stoumen
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A vscode extension to quickly print variable, variable type, tensor shape etc by using shortcuts

Quick Python Print This repo is inspired by "Python Quick Print". "Python Quick Print" can quickly print out variables on the console by using shortcu

weida wang 5 Oct 28, 2022
a vscode extension for http response data auto transform ts type.

Api2ts 这是一个自动将 http 的响应数据转化为 ts 的类型,使用 json-to-ts 做的。 Features 框选配置项后,使用快捷键 alt+Q : 请求参数配置文件 在根目录下创建 Api2ts.config.json 文件,配置项如下: { "baseURL": "http

phy-lei 6 Jun 30, 2022
🐬 A simplified implementation of TypeScript's type system written in TypeScript's type system

?? HypeScript Introduction This is a simplified implementation of TypeScript's type system that's written in TypeScript's type annotations. This means

Ronen Amiel 1.8k Dec 20, 2022
This simple extension can automatically load NBN availability information for properties on realestate.com.au & domain.com.au including technology type, maximum line speed, and co-existance status if available.

NBN Availability Check Chrome Extension This simple extension can automatically load NBN availability information for properties on realestate.com.au

Luke Prior 17 Aug 17, 2022
A refined tool for exploring open-source projects on GitHub with a file tree, rich Markdown and image previews, multi-pane multi-tab layouts and first-class support for Ink syntax highlighting.

Ink codebase browser, "Kin" ?? The Ink codebase browser is a tool to explore open-source code on GitHub, especially my side projects written in the In

Linus Lee 20 Oct 30, 2022
A card for Home Assistant Lovelace for exploring the history of your entities interactively and in real time.

History explorer card This is a custom history card for Home Assistant. This card offers a highly interactive and configurable way to view the history

null 165 Dec 31, 2022
For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker

For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker. We will create a frontend, a backend, and a database to deploy the Pulumipus Boba Tea Shop. Along the way, we'll learn more about how Pulumi works.

Kat Cosgrove 9 Dec 29, 2022
Open! Inclusive! Collaborative! A community for enthusiasts exploring new technologies, working on innovative ideas and helping each other grow together. Open Issues, Raise ideas, Make Pull Requests!

About Us OplnCo previously known as Devstucom represents Open Inclusive Collaborative. We as a community help our fellow students build skills through

OpInCo Community 4 Oct 13, 2022
Utilities to work with protocol handlers (like "vscode://") on the web.

Protocol Handlers Utilities to work with protocol handlers on the web. Why? While the Navigator API provides methods to .registerProtocolHandler() and

Artem Zakharchenko 11 Oct 1, 2022
Combine type and value imports using Typescript 4.5 type modifier syntax

type-import-codemod Combines your type and value imports together into a single statement, using Typescript 4.5's type modifier syntax. Before: import

Ian VanSchooten 4 Sep 29, 2022
A type programming language which compiles to and interops with type-level TypeScript

Prakaar Prakaar (hindi for "type") is a type programming language which compiles to and interops with type-level TypeScript. Prakaar itself is also a

Devansh Jethmalani 17 Sep 21, 2022
A transpiler from golang's type to typescript's type for collaboration between frontend & backend.

go2type go2type.vercel.app (backup site) A typescript transpiler that convert golang's type to typescript's type. Help front-end developer to work fas

Oanakiaja 8 Sep 26, 2022
JSDoc generator for JavaScript, TypeScript using AI. (VSCode extension)

JSDoc generator for JavaScript, TypeScript using AI. (VSCode extension)

Amir Reza Dalir 3 Aug 18, 2022
The Main Purpose The main purpose of creating an anaonline information system, as an effort responsive to the management of the data of the Members of the Persis Youth based on information technology systems

landing-page-pp landing-page-pp.vercel.app #The Main Purpose The main purpose of creating an anaonline information system, as an effort responsive to

Hilman Firdaus 6 Oct 21, 2022
Resolve parallel promises in key-value pairs whilst maintaining type information

async-kv Resolves promises in key-value pairs maintaining type information. Prerequisites NodeJS 12 or later Installation npm i async-kv yarn add asyn

Tony Tamplin 4 Feb 17, 2022
CTF (Capture The Flag) is a type of information security competition that challenges contestants to find solutions or complete various tasks.

WHAT IS CTF? CTF (Capture The Flag) is a type of information security competition that challenges contestants to find solutions or complete various ta

Nicolas Saputra Gunawan 18 Dec 12, 2022
A fast and powerful http toolkit that take a list of domains to find active domains and other information such as status-code, title, response-time , server, content-type and many other

HTTPFY curently in beta so you may see problems. Please open a Issue on GitHub and report them! A Incredible fast and Powerful HTTP toolkit Report Bug

DevXprite 44 Dec 22, 2022