We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kea-typegen
kea
typescript
index.ts:
import { actions, kea, reducers } from 'kea'; import type { testLogicType } from './indexType'; import { TestModule } from './testModule'; export const testLogic = kea<testLogicType>([ actions({ testAction: true, testAction2: (input: TestModule.Type1) => ({ input }), }), reducers({ testReducer: [{} as TestModule.Type2], }), ]);
testModule.ts:
export * as TestModule from './testTypes';
testTypes.ts:
export interface Type1 {} export interface Type2 {}
import type { Logic } from 'kea' import type { TestModule, Type1 } from './testTypes' export interface testLogicType extends Logic { actionCreators: { testAction: () => { type: 'test action (src.logic.core.test.index)'; payload: { value: true; }; }; testAction2: (input: TestModule.Type1) => { type: 'test action2 (src.logic.core.test.index)'; payload: { input: Type1; }; }; }; actionKeys: { 'test action (src.logic.core.test.index)': 'testAction'; 'test action2 (src.logic.core.test.index)': 'testAction2'; }; actionTypes: { testAction: 'test action (src.logic.core.test.index)'; testAction2: 'test action2 (src.logic.core.test.index)'; }; actions: { testAction: () => void; testAction2: (input: TestModule.Type1) => void; }; defaults: { testReducer: TestModule.Type2; }; events: {}; key: undefined; listeners: {}; path: ['src', 'logic', 'core', 'test', 'index']; pathString: 'src.logic.core.test.index'; props: Record<string, unknown>; reducer: ( state: any, action: any, fullState: any, ) => { testReducer: TestModule.Type2; }; reducers: { testReducer: ( state: TestModule.Type2, action: any, fullState: any, ) => TestModule.Type2; }; selector: (state: any) => { testReducer: TestModule.Type2; }; selectors: { testReducer: (state: any, props?: any) => TestModule.Type2; }; sharedListeners: {}; values: { testReducer: TestModule.Type2; }; _isKea: true; _isKeaWithKey: false; }
import type { Logic } from 'kea' import type { TestModule } from './testModule' export interface testLogicType extends Logic { actionCreators: { testAction: () => { type: 'test action (src.logic.core.test.index)'; payload: { value: true; }; }; testAction2: (input: TestModule.Type1) => { type: 'test action2 (src.logic.core.test.index)'; payload: { input: TestModule.Type1; }; }; }; actionKeys: { 'test action (src.logic.core.test.index)': 'testAction'; 'test action2 (src.logic.core.test.index)': 'testAction2'; }; actionTypes: { testAction: 'test action (src.logic.core.test.index)'; testAction2: 'test action2 (src.logic.core.test.index)'; }; actions: { testAction: () => void; testAction2: (input: TestModule.Type1) => void; }; defaults: { testReducer: TestModule.Type2; }; events: {}; key: undefined; listeners: {}; path: ['src', 'logic', 'core', 'test', 'index']; pathString: 'src.logic.core.test.index'; props: Record<string, unknown>; reducer: ( state: any, action: any, fullState: any, ) => { testReducer: TestModule.Type2; }; reducers: { testReducer: ( state: TestModule.Type2, action: any, fullState: any, ) => TestModule.Type2; }; selector: (state: any) => { testReducer: TestModule.Type2; }; selectors: { testReducer: (state: any, props?: any) => TestModule.Type2; }; sharedListeners: {}; values: { testReducer: TestModule.Type2; }; _isKea: true; _isKeaWithKey: false; }
import type { Logic } from 'kea' import type { Type1, Type2 } from './testTypes' export interface testLogicType extends Logic { actionCreators: { testAction: () => { type: 'test action (src.logic.core.test.index)'; payload: { value: true; }; }; testAction2: (input: Type1) => { type: 'test action2 (src.logic.core.test.index)'; payload: { input: Type1; }; }; }; actionKeys: { 'test action (src.logic.core.test.index)': 'testAction'; 'test action2 (src.logic.core.test.index)': 'testAction2'; }; actionTypes: { testAction: 'test action (src.logic.core.test.index)'; testAction2: 'test action2 (src.logic.core.test.index)'; }; actions: { testAction: () => void; testAction2: (input: Type1) => void; }; defaults: { testReducer: Type2; }; events: {}; key: undefined; listeners: {}; path: ['src', 'logic', 'core', 'test', 'index']; pathString: 'src.logic.core.test.index'; props: Record<string, unknown>; reducer: ( state: any, action: any, fullState: any, ) => { testReducer: Type2; }; reducers: { testReducer: ( state: Type2, action: any, fullState: any, ) => Type2; }; selector: (state: any) => { testReducer: Type2; }; selectors: { testReducer: (state: any, props?: any) => Type2; }; sharedListeners: {}; values: { testReducer: Type2; }; _isKea: true; _isKeaWithKey: false; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment
kea-typegen
version: ^3.1.3kea
version: ^3.0.2typescript
version: ^4.7.4This logic:
index.ts:
testModule.ts:
testTypes.ts:
Produces this type:
It should instead:
Or this:
The text was updated successfully, but these errors were encountered: