Closed martaver closed 7 years ago
Of course, it will be appreciated if you export this lib to typings ;) On Sat, Aug 12, 2017 at 1:04 PM Sebastian Nemeth notifications@github.com wrote:
We're using Prismic in a new React/TS project and noticed that this library is written in Typescript too. Unfortunately, none of the types are exported.
Could we export some types to DefinitelyTyped? We would be happy to beta test this library going forward.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/prismicio/prismic-javascript/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtiX_Q0J2VTtodU5E0uzqr8136bqI6Xks5sXYa1gaJpZM4O1Yp1 .
-- Arnaud Lewis Prismic.io
tel: 0787647471 email: arnaud@prismic.io
The typings are all already there in the d.ts folder...
Could you maybe just include them in the npm package? All you'd need to do is export them in index.d.ts and then include the 'types' property in package.json.
https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
we'll expose the lib probably next week after the next release @Martaver.
Hello!
I'm trying to integrate this library with our Node.js TypeScript project, but I can't import it correctly.
The line:
import * as Prismic from 'prismic-javascript';
gives me the error:
error TS7016: Could not find a declaration file for module 'prismic-javascript'. '.../node_modules/prismic-javascript/dist/prismic-javascript.min.js' implicitly has an 'any' type. Try "npm install @types/prismic-javascript" if it exists or add a new declaration (.d.ts) file containing "declare module 'prismic-javascript';"
Strangely, the same import works when used directly in Angular application.
How do I integrate it correctly to my project?
I can see the typings in d.ts
directory under node_modules/prismic-javascript
, but for some reason they are not loaded or just missing something.
Thanks.
Hi, you just have to import the declaration but it’s not available on DefinitelyTyped yet or you can just allow using any type implicitly in your tsconfig. Hope it helps On Thu 31 Aug 2017 at 20:16, Slava Fomin II notifications@github.com wrote:
Hello!
I'm trying to integrate this library with our Node.js TypeScript project, but I can't import it correctly.
The line:
import * as Prismic from 'prismic-javascript';
gives me the error:
error TS7016: Could not find a declaration file for module 'prismic-javascript'. '.../node_modules/prismic-javascript/dist/prismic-javascript.min.js' implicitly has an 'any' type. Try "npm install @types/prismic-javascript" if it exists or add a new declaration (.d.ts) file containing "declare module 'prismic-javascript';"
Strangely, the same import works when used directly in Angular application.
How do I handle that?
Thanks.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/prismicio/prismic-javascript/issues/14#issuecomment-326379478, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtiXzc_x9h6GcTkYq4fHMyaV-7Fh7NNks5sdvh9gaJpZM4O1Yp1 .
-- Arnaud Lewis Prismic.io
tel: 0787647471 email: arnaud@prismic.io
You know you just need to add this to your package.json right?
{
"types": "./d.ts/index.d.ts"
}
The index.d.ts file seems empty at the moment. Is someone looking at this issue?
Hey,
Sorry for the dalay... I'm going to look at it.
Just let you know we're preparing a new release where type definitions should change.
Should be done with this PR https://github.com/prismicio/prismic-javascript/pull/24
We're using Prismic in a new React/TS project and noticed that this library is written in Typescript too. Unfortunately, none of the types are exported.
Could we export some types to DefinitelyTyped? We would be happy to beta test this library going forward.