Reputation: 63
I developed this React main project (foo-proj) and a React design library (foo-lib). In order to improve local development I used "npm link" to use foo-lib inside foo-proj.
- foo-proj
- ... (npm link foo-lib)
- foo-lib
- symlink
- - foo-lib
- - ...(npm link)
- - - index.js
- - - index.map.js
- - - index.d.ts
- - - package.json [{types: "./index.d.ts"}]
About foo-lib:
Developed with react, and made the exported files with "rollup". After the rollup process I copied the files into an external directory (symlink/foo-lib) and once there I run the npm link
script, I did this cause at some point I was having issues with React instances.
About foo-proj:
Developed with react, here I consume foo-lib with npm link foo-lib
script.
Use case:
import React from 'react'
import { FooComponent } from 'foo-lib'
const Test = () => {
return (
<FooComponent text='foo'>
</FooComponent>
)
}
export default Test
Everything works fine but the prop types. FooComponent can be used with no problems, does not have compile problems. The idea of use typescript is to take advantage of typing but I can't figure it out how to this can work.
Upvotes: 1
Views: 134