Skip to content

Incorrect usage of import instead of import type for type-only imports in documentation and source code #1928

@lightning-sagar

Description

@lightning-sagar

Which package/packages do you use?

  • @stream-io/video-react-sdk
  • @stream-io/video-react-native-sdk
  • @stream-io/video-client

Describe the bug

Some files and the documentation import types using a regular import instead of import type.
This can cause issues with certain build tools like Vite or Next.js and goes against TypeScript best practices.

For example, in the SDK source and docs:

import {
  AllClientEvents,
  ClientEventListener,
  Logger,
  StreamClientOptions,
  TokenOrProvider,
  TokenProvider,
  User,
  UserWithId,
} from './coordinator/connection/types';

This should instead be:

import type {
  AllClientEvents,
  ClientEventListener,
  Logger,
  StreamClientOptions,
  TokenOrProvider,
  TokenProvider,
  User,
  UserWithId,
} from './coordinator/connection/types';

To Reproduce

  1. Follow the React SDK documentation [here](https://getstream.io/video/docs/react.md).
  2. Copy a snippet where these types are imported directly.
  3. Run the project in a TypeScript environment with strict settings (e.g., using Vite).
  4. Observe build warnings or potential runtime issues related to incorrect type imports.

Expected behavior

  • Types should be imported using import type so they are:

    • Clearly recognized as type-only imports.
    • Removed from the compiled JavaScript output.
    • Compatible with bundlers and strict TypeScript settings.

Screenshots

Image in this User is an type, but it is importing directly

Additional context

This issue appears in both:

  • The SDK source code.
  • The official documentation snippets.

Switching to import type fixed issues for me when using Vite with strict TypeScript settings.
This is also a recommended TypeScript best practice and helps with tree-shaking and clearer code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions