diff --git a/types/klaw-sync/index.d.ts b/types/klaw-sync/index.d.ts
index 23eb661174..1bdd409dfc 100644
--- a/types/klaw-sync/index.d.ts
+++ b/types/klaw-sync/index.d.ts
@@ -5,32 +5,36 @@
///
-import * as fs from "fs"
+import * as fs from 'fs'
-export interface Item {
- path: string
- stats: fs.Stats
+declare namespace klawSync {
+ interface Item {
+ path: string
+ stats: fs.Stats
+ }
+
+ interface Options {
+ /**
+ * any paths or `micromatch` patterns to ignore.
+ *
+ * For more information on micromatch patterns: https://github.com/jonschlinkert/micromatch#features
+ */
+ ignore?: string | string[]
+ /**
+ * True to only return files (ignore directories).
+ *
+ * Defaults to false if not specified.
+ */
+ nodir?: boolean
+ /**
+ * True to only return directories (ignore files).
+ *
+ * Defaults to false if not specified.
+ */
+ nofile?: boolean
+ }
}
-export interface Options {
- /**
- * any paths or `micromatch` patterns to ignore.
- *
- * For more information on micromatch patterns: https://github.com/jonschlinkert/micromatch#features
- */
- ignore?: string | string[]
- /**
- * True to only return files (ignore directories).
- *
- * Defaults to false if not specified.
- */
- nodir?: boolean
- /**
- * True to only return directories (ignore files).
- *
- * Defaults to false if not specified.
- */
- nofile?: boolean
-}
+declare function klawSync(root: string, options?: klawSync.Options): ReadonlyArray
-export function klawSync(root: string, options?: Options): ReadonlyArray-
+export = klawSync
diff --git a/types/klaw-sync/klaw-sync-tests.ts b/types/klaw-sync/klaw-sync-tests.ts
index 5c2b806108..4808146882 100644
--- a/types/klaw-sync/klaw-sync-tests.ts
+++ b/types/klaw-sync/klaw-sync-tests.ts
@@ -1,20 +1,20 @@
-import { klawSync, Item } from "klaw-sync"
-import * as path from "path"
+import * as path from 'path'
+import klawSync = require('klaw-sync')
-const outputMessage = (result: Item) => {
+const outputMessage = (result: klawSync.Item) => {
console.log(`file: ${result.path} has size '${result.stats.size}'`)
}
klawSync('/some/dir').forEach(outputMessage)
-const defaultOptions = { }
+const defaultOptions = {}
klawSync('/some/dir', defaultOptions).forEach(outputMessage)
const options = {
- ignore: [ '.exe' ],
+ ignore: ['.exe'],
nodir: true,
- nofile: false
+ nofile: false,
}
klawSync('/some/dir', options).forEach(outputMessage)