Specify several types of definition files in package.json

I am working on creating type definitions for the node [1] library, but I am having problems organizing files.

I added a field typingsto package.json and this works fine, the problem is that I want to specify several type definition files, since the library itself is divided into two entry points:

  • stylized components
  • stylized-component / native

So, I created type definitions for both entry points, but I'm not sure how to use the field correctly typings. This is the structure that I have (I include only what is relevant):

├── index.js
├── native.js
├── package.json
├── typings
│   ├── styled-components-native-test.tsx
│   ├── styled-components-native.d.ts
│   ├── styled-components-test.tsx
│   └── styled-components.d.ts

styled-components.d.ts , , import styled from "styled-components". styled-components-native.d.ts , , import { x } from "styled-components/native".

typings package.json typings/styled-components.d.ts, styled-components-native.d.ts .

index.d.ts ( ) , .

, ?

[1] PR https://github.com/styled-components/styled-components/pull/152

+4

Source: https://habr.com/ru/post/1660868/


All Articles