Skip to content

Commit

Permalink
Merge pull request #151 from blocknative/fix/exported-types
Browse files Browse the repository at this point in the history
Fix: Exported types
  • Loading branch information
lnbc1QWFyb24 authored Jul 30, 2020
2 parents 340e3ea + 8968d61 commit 4b7a490
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 38 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"notifications"
],
"main": "dist/notify.umd.js",
"module": "dist/notify.esm.js",
"typings": "dist/src/notify.d.ts",
"module": "dist/notify.js",
"typings": "dist/types/notify.d.ts",
"files": [
"dist"
],
Expand All @@ -28,12 +28,12 @@
"@rollup/plugin-commonjs": "^12.0.0",
"@rollup/plugin-json": "^4.0.0",
"@rollup/plugin-node-resolve": "^8.0.0",
"@rollup/plugin-typescript": "^5.0.2",
"@tsconfig/svelte": "^1.0.4",
"@types/lodash.debounce": "^4.0.6",
"@types/uuid": "^3.4.5",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@wessberg/rollup-plugin-ts": "^1.2.34",
"babel-plugin-external-helpers": "^6.18.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
Expand Down
8 changes: 5 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import svelte from 'rollup-plugin-svelte'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import sveltePreprocess from 'svelte-preprocess'
import typescript from '@rollup/plugin-typescript'
import typescript from '@wessberg/rollup-plugin-ts'
import json from '@rollup/plugin-json'

export default [
Expand Down Expand Up @@ -31,14 +31,16 @@ export default [
dedupe: ['svelte']
}),
commonjs(),
typescript()
typescript({
tsconfig: resolvedConfig => ({ ...resolvedConfig, declaration: false })
})
]
},
{
input: 'src/notify.ts',
output: {
format: 'es',
file: 'dist/notify.esm.js',
file: 'dist/notify.js',
sourcemap: 'inline'
},
onwarn: (warning, warn) => {
Expand Down
12 changes: 6 additions & 6 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,32 +176,32 @@ export interface ConfigOptions {
clientLocale?: string
}

interface Hash {
export interface Hash {
(hash: string, id?: string):
| never
| { details: TransactionLog; emitter: Emitter }
}

interface Transaction {
export interface Transaction {
(options: TransactionOptions): { result: Promise<string>; emitter: Emitter }
}

interface Account {
export interface Account {
(address: string): never | { details: { address: string }; emitter: Emitter }
}

interface Unsubscribe {
export interface Unsubscribe {
(addressOrHash: string): void
}

interface Notification {
export interface Notification {
(notificationObject: CustomNotificationObject): {
dismiss: () => void
update: UpdateNotification
}
}

interface Config {
export interface Config {
(options: ConfigOptions): void
}

Expand Down
39 changes: 37 additions & 2 deletions src/notify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { handleTransactionEvent, preflightTransaction } from './transactions'
import { createNotification } from './notifications'

import { getBlocknative } from './services'
import type { LocaleMessages } from './interfaces'

import type {
InitOptions,
Expand All @@ -22,7 +21,43 @@ import type {
TransactionOptions,
CustomNotificationObject,
UpdateNotification,
ConfigOptions
ConfigOptions,
LocaleMessages
} from './interfaces'

export type {
InitOptions,
TransactionHandler,
TransactionEvent,
System,
TransactionEventCode,
TransactionData,
NotificationType,
CustomNotificationObject,
BitcoinInputOutput,
NotificationObject,
ContractObject,
AppStore,
NotifyMessages,
LocaleMessages,
TransactionOptions,
PreflightEvent,
UpdateNotification,
ConfigOptions,
Hash,
Transaction,
Account,
Unsubscribe,
Notification,
Config,
API,
TransactionLog,
EmitterListener,
Emitter,
NotificationDetails,
WritableStore,
TransactionStore,
NotificationStore
} from './interfaces'

import {
Expand Down
10 changes: 8 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": { "esModuleInterop": true, "resolveJsonModule": true, "target": "ESNEXT" },
"compilerOptions": {
"esModuleInterop": true,
"resolveJsonModule": true,
"target": "ESNEXT",
"declaration": true,
"declarationDir": "dist/types"
},
"include": ["src/**/*"],
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
"exclude": ["node_modules/*", "dist/*"]
}
Loading

0 comments on commit 4b7a490

Please sign in to comment.