diff --git a/examples/with-typescript/index.ts b/examples/with-typescript/index.ts new file mode 100644 index 00000000..1874c65d --- /dev/null +++ b/examples/with-typescript/index.ts @@ -0,0 +1,8 @@ +import * as prismic from '@prismicio/client' + +const endpoint = prismic.getEndpoint('my-repo') +const client = prismic.createClient(endpoint) + +const homepage = await client.getByUID('page', 'home') +console.log(homepage) +// => The `page` document with a UID of `home` diff --git a/examples/with-typescript/package-lock.json b/examples/with-typescript/package-lock.json new file mode 100644 index 00000000..97a98a43 --- /dev/null +++ b/examples/with-typescript/package-lock.json @@ -0,0 +1,81 @@ +{ + "name": "with-typescript", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "@prismicio/client": "^4.0.0" + }, + "devDependencies": { + "typescript": "^4.2.4" + } + }, + "node_modules/@prismicio/client": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-4.0.0.tgz", + "integrity": "sha512-3rGie+Banm61hOQcKF75+TI8oquVDT2PyX05ho2eRKdiMu0i4raHVJCuIAGBs/CDCuVXes2h/rnfRs+eKfq7XQ==", + "dependencies": { + "cross-fetch": "^3.0.6" + } + }, + "node_modules/cross-fetch": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", + "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", + "dependencies": { + "node-fetch": "2.6.1" + } + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + } + }, + "dependencies": { + "@prismicio/client": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-4.0.0.tgz", + "integrity": "sha512-3rGie+Banm61hOQcKF75+TI8oquVDT2PyX05ho2eRKdiMu0i4raHVJCuIAGBs/CDCuVXes2h/rnfRs+eKfq7XQ==", + "requires": { + "cross-fetch": "^3.0.6" + } + }, + "cross-fetch": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", + "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", + "requires": { + "node-fetch": "2.6.1" + } + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "dev": true + } + } +} diff --git a/examples/with-typescript/package.json b/examples/with-typescript/package.json new file mode 100644 index 00000000..ab6b4f80 --- /dev/null +++ b/examples/with-typescript/package.json @@ -0,0 +1,8 @@ +{ + "dependencies": { + "@prismicio/client": "^5.0.0" + }, + "devDependencies": { + "typescript": "^4.2.4" + } +}