Skip to content

Commit

Permalink
feat(typescript): export the LDProps interface for access in applicat…
Browse files Browse the repository at this point in the history
…ion code (#321)

**Requirements**

- [ ] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [ ] I have validated my changes against all supported platform
versions

**Related issues**

#322

**Describe the solution you've provided**

With this change, it is possible to import the LDProps type from the
library like this:
```ts
import type {LDProps} from 'launchdarkly-react-client-sdk'
```

**Describe alternatives you've considered**

The current workarounds have involved duplicating the TS interface into
the codebase or attempting to infer it from the `withLDConsumer`
parameter types. The latter option does not work well with IDEs and
IntelliSense.

**Additional context**

N/A

---------

Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
  • Loading branch information
kallevmercury and kinyoklion authored Nov 1, 2024
1 parent 186c66f commit 7a084c5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ export interface AllFlagsLDClient {
*/
export type LDFlagKeyMap = Record<string, string>;

export { type LDProps } from './withLDConsumer';

/**
* The sdk context stored in the Provider state and passed to consumers.
*/
Expand Down

0 comments on commit 7a084c5

Please sign in to comment.