Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Add prebuild script and tsconfig to generate declarations #125

Merged
merged 2 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"main": "dist/Shepherd.js",
"module": "dist/Shepherd.es.js",
"jsnext:main": "dist/Shepherd.es.js",
"types": "dist/index.d.ts",
"homepage": "https://shipshapecode.github.io/react-shepherd/",
"engines": {
"node": ">=8",
Expand All @@ -15,6 +16,7 @@
"scripts": {
"test": "cross-env CI=1 react-scripts test",
"test:watch": "react-scripts test",
"prebuild": "tsc --project ./tsconfig-declarations.json",
"build": "rollup -c",
"start": "rollup -c -w",
"prepare": "yarn run build",
Expand Down
4 changes: 3 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const addSteps = (steps: Array<Step> | Array<Step.StepOptions>, tour: Tour) => {
step.buttons = buttons.map((button: ShepherdStepWithType) => {
const { type, classes, text, action } = button;
return {
action: action || tour[type],
// TypeScript doesn't have great support for dynamic method calls with
// bracket notation, so we use the `any` escape hatch
action: action || (tour as any)[type!],
classes,
text,
type
Expand Down
9 changes: 9 additions & 0 deletions tsconfig-declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"isolatedModules": false,
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true
}
}