Skip to content
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

Type Error: Main types folder in '@react-pdf/renderer' not importing some types from nested "types" folder #1979

Open
jcramercodes opened this issue Aug 22, 2022 · 2 comments

Comments

@jcramercodes
Copy link

Describe the bug

Many components will throw typescript errors due to insufficient alignment between '@react-pdf/types' and '@react-pdf/renderer/index.d.ts' ->

For example the "bookmark" prop will throw an error when added to any component because NodeProps interface doesn't have the "bookmark?: Bookmark" type.

Simply importing:

import { Bookmark } from '@react-pdf/types/bookmark';

and then adding -

interface NodeProps {
id?: string;
style?: Style | Style[];
fixed?: boolean;
break?: boolean;
minPresenceAhead?: number;
bookmark?: Bookmark;
}

-addresses this issue. But obviously an update in the package manager (adding/removing other libs) will constantly overwrite the types directory.

Is there any plans to remedy these type issues? Otherwise - what would you recommend?

@ghost
Copy link

ghost commented Aug 24, 2022

Seems lot of type issues due to this #1965

This was referenced Aug 27, 2022
@jordhanpoillot
Copy link

jordhanpoillot commented Aug 30, 2022

You can use :

  const properties = {
    bookmark: "Coordonnées",
  };

  return (
    <View style={StylesGlobal.section} wrap={true} {...properties}>
      <Text style={styles.titre}>Coordonnées</Text>
      <ItemsTable data={coordonnees} columns={colonnesCoordonnees} />
    </View>
  );

or :

  return (
    <View style={StylesGlobal.section} wrap={true} {...{bookmark: "Coordonnées"}}>
      <Text style={styles.titre}>Coordonnées</Text>
      <ItemsTable data={coordonnees} columns={colonnesCoordonnees} />
    </View>
  );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants