-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
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
SplitIO does not seem to be properly imported into the files #130
Comments
Hi @profaurore , The problem you have is that the import { ISplitState } from '@splitsoftware/splitio-redux';
type LocalTreatmentWithConfig = ISplitState['treatments'][string][string];
const someTreatmentWithConfig: LocalTreatmentWithConfig = {
treatment: 'on',
config: null
};
// SplitIO.TreatmentWithConfig and LocalTreatmentWithConfig are the same types
const sameTreatmentWithConfig: SplitIO.TreatmentWithConfig = someTreatmentWithConfig; Note that the The You can check this line, for the complete list of TypeScript definitions that the Redux SDK exports but are not part of the namespace: // Types
import type { IStatus, ISplitState, IGetSplitState, IInitSplitSdkParams, IGetTreatmentsParams, IDestroySplitSdkParams, ITrackParams } from '@splitsoftware/splitio-redux'; |
Hi @EmilianoSanchez, thank you for the prompt response! I must have a Typescript configuration that is interfering with the namespace import. If I do the following, the resulting type is import type { ISplitState } from '@splitsoftware/splitio-redux';
type TestType = ISplitState['treatments'][string][string]; Whereas if I do the following, the resulting type is the expected import type { ISplitState } from '@splitsoftware/splitio-redux';
import type SplitIO from '@splitsoftware/splitio/types/splitio';
type TestType = ISplitState['treatments'][string][string]; I'll take a closer look on Monday and report back any findings in case others run into the same problem. Feel free to close this issue beforehand, if appropriate. |
The As a result, any projects using this package that want the As a fix in our project, we imported the namespace globally in import '@splitsoftware/splitio/types/splitio'; |
Thanks @profaurore for sharing! Unfortunately, I couldn't reproduce it on my side. Could you share the version of the Redux SDK ( |
I am working on a Typescript application that makes use of this package, and have been unable to the get Typescript types that use
SplitIO.*
to correctly resolve; they all resolve toany
. Are there some imports that are missing?For example,
The text was updated successfully, but these errors were encountered: