Skip to content

Missing TypeScript declarations for subpath exports (react-native) #387

@IgorShcherba

Description

@IgorShcherba

Description

The contentstack package provides subpath exports like contentstack/react-native, contentstack/web,
and contentstack/nativescript, but does not include corresponding TypeScript declaration files (.d.ts).

Environment

  • contentstack version: 3.24.1 (also affects latest 3.27.0)
  • TypeScript version: 5.x
  • Package managers: npm/yarn

Steps to Reproduce

  1. Install contentstack in a TypeScript project:
    npm install contentstack
    
  2. Import the React Native entry point:
    import Contentstack from 'contentstack/react-native';
  3. TypeScript error:
    Could not find a declaration file for module 'contentstack/react-native'.
    '/path/to/node_modules/contentstack/react-native.js' implicitly has an 'any' type.
    Try npm i --save-dev @types/contentstack if it exists or add a new declaration
    (.d.ts) file containing declare module 'contentstack/react-native';

Current Behavior

  • The package provides index.d.ts for the main entry point
  • Subpath exports (react-native.js, web.js, nativescript.js) have no corresponding .d.ts files
  • TypeScript cannot infer types for these imports

Expected Behavior

TypeScript should pick up types for all provided entry points.

Suggested Solutions

either add react-native.d.ts, web.d.ts, and nativescript.d.ts that re-export the root types or use package.json exports field

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions