Closed lachenmayer closed 3 years ago
Actually this seems to be fixed in the latest react-native-builder-bob
. https://github.com/callstack/react-native-builder-bob/issues/140
@avishayil
I have this problem too. please review and merge this if it's fix the problem, Thanks
@lachenmayer
I applied your changes manually in my project, but I still, have a TS error.
is it working perfectly on your project?
when I moving the file index.d.ts
to the root directory of the repository and change the path in package.json
to "types": "index.d.ts",
, the error is gone.
@avishayil please consider it too before merging.
I'll review it this week, sorry for the time it takes...
im getting the same error but with JS instead of TS. do you know if its the same problem?
@avishayil is there any progress on this? Thanks for your time.
I encountered the same problem, and @lachenmayer's fix is an easy one that works. :) I wanted to second the notion to approve this PR because this is an issue that we also cannot patch-package
unfortunately, due to it concerning the package.json
file. :/
@TheWirv
have you encountered the problem I mentioned in this comment after applying @lachenmayer's fix?
@TheWirv
have you encountered the problem I mentioned in this comment after applying @lachenmayer's fix?
@SaeedZhiany No, it works perfectly fine for me, sorry. :(
What typescript version you are using?
What typescript version you are using?
4.2.4
I tried that version, it seems the problem is not related to the typescript version. However, the update section in this comment is also resolving my problem, I hope @avishayil review and fix the issue soon.
I don't know why but I just figured out that the structure of the repository is pretty different from what we are installing.
installed package | sadsa |
---|---|
there is no lib
directory in the repository and I'm wondering how it has been generated.
However, I found a way to resolve the TS error I reported in this comment. when I replace the content of the file /lib/typescript/index.d.ts
with the code below, the problem is resolving.
declare module 'react-native-restart' {
type RestartType = {
Restart(): void;
};
const RNRestart: RestartType;
export default RNRestart;
}
I wanted to make a PR for this to integrate @lachenmayer PR and my solution to resolve typing problems but as I said early, I couldn't the file in the repository to modify.
@avishayil please apply these changes soon, I really need them in my project. Thanks
@avishayil did you read my comments above?
Hi @SaeedZhiany the lib folder is create using the bob build
command which packages and prepares the artifact to be deployed to npm.
is there any way to solve my problem too? the change of this PR does not work for me as I said before.
Thank you all for the effort to solve this issue for the community. I've met the same issue this week as well, and figured out it's been fixed already, that's amazing.
Do we have any plan to release a new version to npm soon? Since the latest version on npm (0.0.22) is still with the wrong type path in the package.json
file.
Appreciate all the help 🙏
@avishayil can we get a new release please?
While we wait for a release i'm patching this issue by creating a new file called react-native-restart.d.ts
with the following contents:
declare module 'react-native-restart' {
type RestartType = {
Restart(): void;
};
const _default: RestartType;
export default _default;
}
Sure. I'm waiting for #167 to release a new version with Windows support.
would you mind a new release? 0.0.22 is still wrong :-/
+1 to @barbieri's comment. 0.0.22
uses the wrong import path, despite the code in the repo being correct
@avishayil would you be so kind and release the new version? There is no need to wait for anything; thank you! :)
@avishayil Can you please release master on npm ? This is blocking us from updating the lib, as its was not a prob back in 0.0.17. Would love to avoid suggested workarounds too, since this is fixed already :)
Do we have some expectation about the next release? :)
Following up to see when this will get release.
Hi there, the TypeScript path in
package.json
is incorrect, causing the import to fail withCould not find a declaration file for module 'react-native-restart'.
when used from TypeScript.I've previously had to make this exact fix this in another library too (https://github.com/greentriangle/react-native-leveldb/pull/1), so I believe this is probably an issue with
react-native-builder-bob
. For now, this fix should solve the import issue in this library though. I will open an issue on thereact-native-builder-bob
repo too.Thanks a lot!