Skip to content

Commit

Permalink
feature(type): added test to show Omit<> works with interface
Browse files Browse the repository at this point in the history
ref #464
  • Loading branch information
marcj committed Oct 1, 2023
1 parent 7fa50d8 commit a47111c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/type/tests/standard-functions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/

import { test, expect } from '@jest/globals';
import { ReceiveType, removeTypeName, resolveReceiveType } from '../src/reflection/reflection.js';
import { ReceiveType, removeTypeName, resolveReceiveType, typeOf } from '../src/reflection/reflection.js';
import { expectEqualType } from './utils.js';
import { stringifyResolvedType } from '../src/reflection/type.js';
import { stringifyResolvedType, stringifyType } from '../src/reflection/type.js';

function equalType<A, B>(a?: ReceiveType<A>, b?: ReceiveType<B>) {
const aType = removeTypeName(resolveReceiveType(a));
Expand Down Expand Up @@ -44,6 +44,16 @@ test('Omit', () => {
equalType<Omit<{ a: string, b: number, c: boolean }, 'a'>, { b: number, c: boolean }>();
});

test('Omit 2', () => {
interface A {
readonly a: string;
readonly value: string;
}

type B = Omit<A, 'value'>;
equalType<B, { a: string }>();
});

test('intersection object', () => {
type a1 = string & {}
type a2 = null & {}
Expand Down

0 comments on commit a47111c

Please sign in to comment.