inferred-types
Advanced tools
Comparing version 0.24.3 to 0.25.0
{ | ||
"name": "inferred-types", | ||
"version": "0.24.3", | ||
"version": "0.25.0", | ||
"description": "Functions which provide useful type inference on TS projects", | ||
@@ -49,2 +49,3 @@ "license": "MIT", | ||
"npm-run-all": "~4.1.5", | ||
"pathe": "^0.3.9", | ||
"prettier": "~2.7.1", | ||
@@ -51,0 +52,0 @@ "rimraf": "^3.0.2", |
@@ -15,3 +15,2 @@ // #autoindex | ||
export * from "./Include"; | ||
export * from "./Includes"; | ||
export * from "./KeyedRecord"; | ||
@@ -45,2 +44,3 @@ export * from "./Keys"; | ||
export * from "./type-conversion/index"; | ||
export * from "./TypeInfo/index"; | ||
@@ -47,0 +47,0 @@ // #endregion auto-indexed files |
import { describe, it, expect } from "vitest"; | ||
import type { Includes } from "../src/types"; | ||
import type { ExpectTrue, ExpectFalse } from "@type-challenges/utils"; | ||
import type { Equal, Expect } from "@type-challenges/utils"; | ||
describe("Includes type check", () => { | ||
it("Includes tests whether string is contained within the string array", () => { | ||
it("Includes works on a string source", () => { | ||
type T = Includes<"Hello World", "Hello">; | ||
type F = Includes<"Hello World", "nada">; | ||
type U = Includes<string, "who cares">; | ||
type N = Includes<"Hello World", string>; | ||
type cases = [ | ||
ExpectTrue<Includes<["foo", "bar", "baz"], "foo">>, | ||
ExpectFalse<Includes<["foo", "bar", "baz"], "nada">> | ||
Expect<Equal<T, true>>, // | ||
Expect<Equal<F, false>>, | ||
Expect<Equal<U, boolean>>, | ||
Expect<Equal<N, boolean>> | ||
]; | ||
const typeTests: cases = [true, false]; | ||
const typeTests: cases = [true, true, true, true]; | ||
expect(typeTests).toBe(typeTests); | ||
}); | ||
it("Includes works on a string[] source", () => { | ||
type T = Includes<["Hello", "World"], "Hello">; | ||
type F = Includes<["Hello", "World"], "nada">; | ||
type U = Includes<string[], "who cares">; | ||
type N = Includes<["Hello", "World"], string>; | ||
type cases = [ | ||
Expect<Equal<T, true>>, // | ||
Expect<Equal<F, false>>, | ||
Expect<Equal<U, boolean>>, | ||
Expect<Equal<N, boolean>> | ||
]; | ||
const typeTests: cases = [true, true, true, true]; | ||
expect(typeTests).toBe(typeTests); | ||
}); | ||
}); |
@@ -19,2 +19,10 @@ { | ||
], | ||
"paths": { | ||
"src/*": [ | ||
"src/*" | ||
], | ||
"test/*": [ | ||
"test/*" | ||
] | ||
}, | ||
"baseUrl": ".", | ||
@@ -21,0 +29,0 @@ "declaration": true, |
/// <reference types="vitest" /> | ||
import { defineConfig } from "vite"; | ||
import { resolve } from "pathe"; | ||
// used for testing, library code uses TSUP to build exports | ||
export default defineConfig({ | ||
resolve: { | ||
alias: { | ||
src: resolve(__dirname, "./src"), | ||
test: resolve(__dirname, "./test"), | ||
}, | ||
}, | ||
test: { | ||
@@ -7,0 +14,0 @@ dir: "tests", |
Sorry, the diff of this file is too big to display
345640
233
9334
23