Skip to content

Commit

Permalink
Test types against dist
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrHoroshih committed Nov 18, 2023
1 parent 9bf2719 commit e07af37
Show file tree
Hide file tree
Showing 27 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"test": "NODE_ENV=test pnpm test:code && pnpm test:types",
"test:code": "jest",
"test:types": "tsc -p ./test-typings",
"test:types": "pnpm build:types && tsc -p ./test-typings",
"format": "prettier --write \"./src/**/**.{ts,tsx,js,jsx,json}\"",
"lint": "eslint ./",
"cleanup": "rm -rf dist && mkdir dist",
Expand Down
2 changes: 1 addition & 1 deletion test-typings/and.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
createEvent,
createEffect,
} from 'effector';
import { and } from '../src/and';
import { and } from '../dist/and';

// Returns always store with boolean
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/combine-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createEffect,
sample,
} from 'effector';
import { combineEvents } from '../src/combine-events';
import { combineEvents } from '../dist/combine-events';

// Check simple combine of different events
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Event,
Store,
} from 'effector';
import { condition } from '../src/condition';
import { condition } from '../dist/condition';

// Correct pass type from source to then, else, and if
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
createDomain,
fork,
} from 'effector';
import { debounce } from '../src/debounce';
import { debounce } from '../dist/debounce';

// Returns the same type as source
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
type Node,
type Scope,
} from 'effector';
import { debug } from '../src/debug';
import { debug } from '../dist/debug';

// Allows each unit of effector
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/delay.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType } from 'tsd';
import { Event, createStore, createEvent, createEffect, Store } from 'effector';
import { delay } from '../src/delay';
import { delay } from '../dist/delay';

// Check valid type for source
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/either.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
createEvent,
createEffect,
} from 'effector';
import { either } from '../src/either';
import { either } from '../dist/either';

// Returns always store with merged type
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/equals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType } from 'tsd';
import { createStore, Store } from 'effector';
import { equals } from '../src/equals';
import { equals } from '../dist/equals';

// Should receive stores with the same type
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/every.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType, expectError } from 'tsd';
import { Store, createStore } from 'effector';
import { every } from '../src/every';
import { every } from '../dist/every';

// Check invalid type for number predicate
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/format.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType } from 'tsd';
import { createStore, Store } from 'effector';
import { format } from '../src/format';
import { format } from '../dist/format';

// Allows stores with any value and returns Store<string>
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/in-flight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
createEffect,
createDomain,
} from 'effector';
import { inFlight } from '../src/in-flight';
import { inFlight } from '../dist/in-flight';

// Check receive effects
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/interval.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType } from 'tsd';
import { Event, createStore, Store, createEvent } from 'effector';
import { interval } from '../src/interval';
import { interval } from '../dist/interval';

// Only required options with void returns void tick
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/not.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createDomain, createEffect, createStore, Store } from 'effector';
import { expectType } from 'tsd';
import { not } from '../src/not';
import { not } from '../dist/not';

// Always returns the store
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/once.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createDomain,
fork,
} from 'effector';
import { once } from '../src/once';
import { once } from '../dist/once';

// Supports Event, Effect and Store as an argument
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/or.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
createEvent,
createEffect,
} from 'effector';
import { or } from '../src/or';
import { or } from '../dist/or';

// Returns always store with boolean
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/pending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
createEffect,
createDomain,
} from 'effector';
import { pending } from '../src/pending';
import { pending } from '../dist/pending';

// Check receive effects
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/reset.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType } from 'tsd';
import { createEvent, createEffect, createStore } from 'effector';
import { reset } from '../src/reset';
import { reset } from '../dist/reset';

import type { Event } from 'effector';

Expand Down
2 changes: 1 addition & 1 deletion test-typings/reshape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createEffect,
createDomain,
} from 'effector';
import { reshape } from '../src/reshape';
import { reshape } from '../dist/reshape';

// Reshapes store with string
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/snapshot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType } from 'tsd';
import { Store, createStore, createEvent, createEffect } from 'effector';
import { snapshot } from '../src/snapshot';
import { snapshot } from '../dist/snapshot';

// Check invalid type for source
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/some.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType, expectError } from 'tsd';
import { Store, createStore } from 'effector';
import { some } from '../src/some';
import { some } from '../dist/some';

// Check invalid type for number predicate
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/split-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createEffect,
sample,
} from 'effector';
import { splitMap } from '../src/split-map';
import { splitMap } from '../dist/split-map';

// partial destructuring throws an error #71
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/spread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createEffect,
sample,
} from 'effector';
import { spread } from '../src/spread';
import { spread } from '../dist/spread';

{
const $source = createStore({ first: '', last: '' });
Expand Down
2 changes: 1 addition & 1 deletion test-typings/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
createEvent,
createDomain,
} from 'effector';
import { status, EffectState } from '../src/status';
import { status, EffectState } from '../dist/status';

// Check that accepts only effect
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/throttle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createEvent,
createEffect,
} from 'effector';
import { throttle } from '../src/throttle';
import { throttle } from '../dist/throttle';

// Returns the same type as source
{
Expand Down
2 changes: 1 addition & 1 deletion test-typings/time.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType } from 'tsd';
import { Store, createStore, createEvent, createEffect, createDomain } from 'effector';
import { time } from '../src/time';
import { time } from '../dist/time';

// Returns correct default Store value
{
Expand Down
4 changes: 3 additions & 1 deletion test-typings/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"strict": true,
"strictNullChecks": true,
"skipLibCheck": true,
}
},
"include": ["./*.ts"],
"exclude": ["node_modules", "../src/**/*"]
}

0 comments on commit e07af37

Please sign in to comment.