Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile --prefer-offline
- uses: nrwl/nx-set-shas@v4
- run: pnpm exec nx affected -t test --exclude=docs-app --skip-nx-cache
- run: pnpm exec nx affected -t test --exclude=docs-app --skip-nx-cache --parallel=3

e2e-affected:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile --prefer-offline
- uses: nrwl/nx-set-shas@v4
- run: pnpm exec nx affected -t build --exclude=docs-app,www --skip-nx-cache
- run: pnpm exec nx affected -t build --exclude=docs-app,www --skip-nx-cache --parallel=3

schematics-core-check:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile --prefer-offline
- uses: nrwl/nx-set-shas@v4
- run: pnpm exec nx run-many -t test --exclude=docs-app --skip-nx-cache
- run: pnpm exec nx run-many -t test --exclude=docs-app --skip-nx-cache --parallel=3

e2e:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile --prefer-offline
- uses: nrwl/nx-set-shas@v4
- run: pnpm exec nx run-many -t build --exclude=docs-app,www
- run: pnpm exec nx run-many -t build --exclude=docs-app,www --skip-nx-cache --parallel=3
- uses: actions/upload-artifact@v4
with:
name: artifact-modules
Expand Down
26 changes: 0 additions & 26 deletions modules/component-store/spec/types/component-store.types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('ComponentStore types', () => {
describe('infers Subscription', () => {
it('when argument type is specified and a variable with corresponding type is passed', () => {
const effectTest = `const sub = componentStore.effect((e: Observable<string>) => number$)('string');`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

Expand All @@ -34,38 +33,32 @@ describe('ComponentStore types', () => {
'a variable with corresponding type is passed',
() => {
const effectTest = `const sub = componentStore.effect((e: Observable<string>) => EMPTY)('string');`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
}
);

it('when argument type is specified and an Observable with corresponding type is passed', () => {
const effectTest = `const sub = componentStore.effect((e: Observable<string>) => EMPTY)(string$);`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when argument type is specified as Observable<unknown> and any type is passed', () => {
const effectTest = `const sub = componentStore.effect((e: Observable<unknown>) => EMPTY)(5);`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when generic type is specified and a variable with corresponding type is passed', () => {
const effectTest = `const sub = componentStore.effect<string>((e) => number$)('string');`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when generic type is specified as unknown and a variable with any type is passed', () => {
const effectTest = `const sub = componentStore.effect<unknown>((e) => number$)('string');`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when generic type is specified as unknown and origin can still be piped', () => {
const effectTest = `const sub = componentStore.effect<unknown>((e) => e.pipe(concatMap(() => of())))('string');`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

Expand All @@ -77,51 +70,43 @@ describe('ComponentStore types', () => {

it('when argument type is an interface and a variable with corresponding type is passed', () => {
const effectTest = `const sub = componentStore.effect((e: Observable<Obj>) => number$)({prop: 'string'});`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when argument type is a partial interface and a variable with corresponding type is passed', () => {
const effectTest = `const sub = componentStore.effect((e: Observable<Partial<Obj>>) => number$)({prop: 'string'});`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});
});

describe('for void types', () => {
it('when generic type is specified as void the argument is optional', () => {
const effectTest = `const sub = componentStore.effect<void>((e) => EMPTY)();`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when argument type is specified as Observable<void> the argument is optional', () => {
const effectTest = `const sub = componentStore.effect((e: Observable<void>) => EMPTY)();`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when type is not specified the argument is optional', () => {
const effectTest = `const sub = componentStore.effect((e) => EMPTY)();`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when type is specified as void the argument can be a void$', () => {
const effectTest = `const sub = componentStore.effect((e: Observable<void>) => EMPTY)(of<void>());`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when type is specified as void the argument can be a void', () => {
const effectTest = `const sub = componentStore.effect((e) => EMPTY)({} as unknown as void);`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});

it('when generic type is specified as void and origin can still be piped', () => {
const effectTest = `const sub = componentStore.effect<void>((e) => e.pipe(concatMap(() => number$)))();`;
expectSnippet(effectTest).toSucceed();
expectSnippet(effectTest).toInfer('sub', 'Subscription');
});
});
Expand Down Expand Up @@ -207,67 +192,56 @@ describe('ComponentStore types', () => {
describe('infers Subscription', () => {
it('when argument type is specified and a variable with corresponding type is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: string) => ({...state}))('string');`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when argument type is specified and an Observable with corresponding type is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: string) => ({...state}))(string$);`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when argument type is an interface and a variable with corresponding type is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: Obj) => ({...state}))({prop: 'obj'});`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when argument type is an partial interface and a variable with corresponding type is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: Partial<Obj>) => ({...state}))({prop: 'obj'});`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when argument type is an enum and a variable with corresponding type is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: LoadingState) => ({...state}))(LoadingState.LOADED);`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when argument type is a union and a variable with corresponding type is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: string|number) => ({...state}))(5);`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when argument type is an intersection and a variable with corresponding type is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: {p: string} & {p2: number}) => ({...state}))({p: 's', p2: 3});`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when argument type is unknown and any variable is passed', () => {
const updaterTest = `const sub = componentStore.updater((state, v: unknown) => ({...state}))({anything: 'works'});`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when generic type is specified and any variable is passed', () => {
const updaterTest = `const sub = componentStore.updater<string>((state, v) => ({...state}))('works');`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('sub', 'Subscription');
});

it('when type is not specified and nothing is passed', () => {
const updaterTest = `const v = componentStore.updater((state) => ({...state}))();`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('v', 'void');
});

it('when type void is specified and nothing is passed', () => {
const updaterTest = `const v = componentStore.updater<void>((state) => ({...state}))();`;
expectSnippet(updaterTest).toSucceed();
expectSnippet(updaterTest).toInfer('v', 'void');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('entityConfig', () => {

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('userConfig', '{ entity: User; }');
});

Expand All @@ -41,7 +40,6 @@ describe('entityConfig', () => {

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('userConfig', '{ entity: User; collection: "user"; }');
});

Expand All @@ -67,7 +65,6 @@ describe('entityConfig', () => {

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer(
'userConfig1',
'{ entity: User; selectId: SelectEntityId<NoInfer<User>>; }'
Expand Down Expand Up @@ -134,7 +131,6 @@ describe('entityConfig', () => {

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer(
'userConfig1',
'{ entity: User; collection: "user"; selectId: SelectEntityId<NoInfer<User>>; }'
Expand Down
21 changes: 0 additions & 21 deletions modules/signals/spec/types/signal-state.types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe('signalState', () => {

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('state', 'SignalState<FooState>');
});

Expand All @@ -51,8 +50,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer(
'state',
'SignalState<{ user: { age: number; details: { first: string; last: string; }; address: string[]; }; numbers: number[]; ngrx: string; }>'
Expand Down Expand Up @@ -98,8 +95,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('user', 'DeepSignal<User>');
result.toInfer('lastName', 'Signal<string>');
result.toInfer('bool', 'Signal<boolean>');
Expand Down Expand Up @@ -127,8 +122,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('arrayStateValue', 'string[]');
result.toInfer('arrayStateKeys', 'unique symbol | unique symbol');
result.toInfer('setStateValue', 'Set<number>');
Expand Down Expand Up @@ -159,8 +152,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('weakSetStateValue', 'WeakSet<{ foo: string; }>');
result.toInfer('weakSetStateKeys', 'unique symbol | unique symbol');
result.toInfer('dateStateValue', 'Date');
Expand All @@ -179,8 +170,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('stateValue', '() => void');
result.toInfer('stateKeys', 'unique symbol | unique symbol');
});
Expand All @@ -201,8 +190,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('state', 'SignalState<State>');
result.toInfer('foo', 'Signal<string | undefined> | undefined');
result.toInfer('bar', 'DeepSignal<{ baz?: number | undefined; }>');
Expand Down Expand Up @@ -247,8 +234,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('state1', 'SignalState<{ [key: string]: number; }>');
result.toInfer('state1Keys', 'unique symbol | unique symbol');
result.toInfer(
Expand Down Expand Up @@ -279,8 +264,6 @@ describe('signalState', () => {
const snippet = `const state = signalState({})`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('state', 'SignalState<{}>');
});

Expand All @@ -306,8 +289,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('state', 'SignalState<State>');
result.toInfer('foo', 'Signal<number | { s: string; }>');
result.toInfer('bar', 'DeepSignal<{ baz: { n: number; } | null; }>');
Expand All @@ -330,8 +311,6 @@ describe('signalState', () => {
`;

const result = expectSnippet(snippet);

result.toSucceed();
result.toInfer('name', 'Signal<number>');
result.toInfer('length1', 'Signal<boolean[]>');
result.toInfer('name2', 'DeepSignal<{ length: string; }>');
Expand Down
Loading