New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

tset

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tset

A Simple Strongly Typed Set for Typescript

latest
npmnpm
Version
0.0.2
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

tset : A simple strongly typed set for typescript

Example

import {TSet} from ".";

//Helper that can be used to help with type inference
function infer<T>(): T {
  return (null as any) as T
}

test('TSet create works', () => {

  const t = TSet(
    //The type of the elements
    // 'null as any as TypeOfElements'
    infer<{
      name: string
    }>(),
    fn => ({
      a: fn({name: "this-is-a"}),
      b: fn({name: "this-is-b"}),
    }))

  expect(t.proto.a.id).toBe("a")
  expect(t.proto.b.id).toBe("b")
  expect(t.proto.a.name).toBe("this-is-a")
  expect(t.proto.b.name).toBe("this-is-b")

});

Keywords

typescript

FAQs

Package last updated on 10 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts