Skip to content

fix: Types not being exported and autocomplete not working #284

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

Merged
merged 2 commits into from
Jan 20, 2025
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
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IFlagsmith } from './types';
declare const flagsmith: IFlagsmith;
export default flagsmith;
export * from './types';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to understand the use of the wildcard export here. In a python context, whenever I see an import *, it's an immediate red flag, but maybe that's not the case here because /types explicitly defines what it wants to export I suppose?

Copy link
Member

@kyle-ssg kyle-ssg Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This'll basically mean we can import anything that was exported in types directly from flagsmith, i.e. it'll let us do

import { IInitConfig, IState } from 'flagsmith';

rather than need to do

import { IInitConfig, IState } from 'flagsmith/types';

It's an improvement rather than a fix to the original issue.

export declare const createFlagsmithInstance: <
F extends string = string,
T extends string = string,
Expand Down
14 changes: 9 additions & 5 deletions lib/flagsmith/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flagsmith",
"version": "9.0.0",
"version": "9.0.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up that I increased the patch version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now you have to keep react-native's inline too

"description": "Feature flagging to support continuous development",
"main": "./index.js",
"module": "./index.mjs",
Expand All @@ -10,22 +10,26 @@
".": {
"import": "./index.mjs",
"require": "./index.js",
"browser": "./index.js"
"browser": "./index.js",
"types": "./index.d.ts"
},
"./isomorphic": {
"import": "./isomorphic.mjs",
"require": "./isomorphic.js",
"browser": "./isomorphic.js"
"browser": "./isomorphic.js",
"types": "./isomorphic.d.ts"
},
"./react": {
"import": "./react.mjs",
"require": "./react.js",
"browser": "./react.js"
"browser": "./react.js",
"types": "./react.d.ts"
},
"./next-middleware": {
"import": "./next-middleware.mjs",
"require": "./next-middleware.js",
"browser": "./next-middleware.js"
"browser": "./next-middleware.js",
"types": "./next-middleware.d.ts"
}
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion lib/react-native-flagsmith/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-flagsmith",
"version": "9.0.0",
"version": "9.0.1",
"description": "Feature flagging to support continuous development",
"main": "./index.js",
"repository": {
Expand Down
5 changes: 3 additions & 2 deletions react.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { FC } from 'react';
import { IFlagsmith, IFlagsmithTrait, IFlagsmithFeature, IState } from '../types';
import { IFlagsmith, IFlagsmithTrait, IFlagsmithFeature, IState, LoadingState } from './types';
export * from './types';
export declare const FlagsmithContext: React.Context<IFlagsmith>;
export declare type FlagsmithContextType<F extends string = string, T extends string = string> = {
flagsmith: IFlagsmith<F, T>;
options?: Parameters<IFlagsmith<F, T>['init']>[0];
serverState?: IState<F, T>;
serverState?: IState;
children: React.ReactElement[] | React.ReactElement;
};
export declare const FlagsmithProvider: FC<FlagsmithContextType>;
Expand Down
Loading