Skip to content

Commit

Permalink
Fix local TS importing strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmhunt committed Apr 21, 2020
1 parent 465425a commit 371e820
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"electron": "^8.2.3",
"fs-extra": "^9.0.0",
"jquery": "^3.5.0",
"karma": "^5.0.2",
"karma-chai": "^0.1.0",
"karma-electron-launcher": "^0.2.0",
"karma-jasmine": "^3.1.1",
Expand All @@ -51,13 +52,12 @@
"karma-sauce-launcher": "^4.1.3",
"karma-sinon": "^1.0.5",
"karma-typescript-preprocessor": "^0.4.0",
"karma": "^5.0.2",
"lerna": "^3.20.2",
"mocha": "^7.1",
"rollup": "^2.6",
"rollup-plugin-license": "^2.0.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-visualizer": "^4.0.4",
"rollup": "^2.6",
"sinon": "^9.0",
"standard": "^14.3.3",
"tslib": "^1.11.1",
Expand All @@ -67,6 +67,5 @@
"packages/*"
],
"private": true,
"dependencies": {
}
"dependencies": {}
}
7 changes: 2 additions & 5 deletions packages/@types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,10 @@ interface KnockoutExtendedArrayObservable<T> extends KnockoutObservable<T[]> {
) : KnockoutComputedArray<U>
}

/**
* These will be added with
interface KnockoutObservableArray<T> extends KnockoutExtendedArrayObservable<T> {
}
interface KnockoutObservableArray<T> extends KnockoutExtendedArrayObservable<T> {
}

interface KnockoutComputedArray<T> extends KnockoutComputed<T>, KnockoutExtendedArrayObservable<T> {}
*/

interface KnockoutLifeCycle {
computed<T>(p: string | (() => T)): KnockoutComputed<T>
Expand Down
15 changes: 8 additions & 7 deletions packages/utils.jsx/src/JsxObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ function isIterableNonString (v: JsxNodeable) {
* `parentNode` at `insertBefore` with the result.
*/
export class JsxObserver extends LifeCycle {
insertBefore: Node
adoptedInsertBefore: boolean
insertBefore: Node
nodeArrayOrObservableAtIndex: Array<Node|(() => Node)> // | KnockoutObservable
noInitialBinding: boolean
parentNode: Node
parentNodeTarget: Node
subscriptionsForNode: Map<Node, Disposable[]>
xmlns: string
subscriptionsForNode: Map<Node, Disposable>
nodeArrayOrObservableAtIndex: Array<Node|(() => Node)> // | KnockoutObservable

/**
* @param {any} jsxOrObservable take a long list of permutations
Expand All @@ -92,7 +93,7 @@ export class JsxObserver extends LifeCycle {
if (!insertBefore) {
const insertAt = parentNodeIsComment ? parentNode.nextSibling : null
insertBefore = this.createComment('O')
parentNodeTarget.insertBefore(insertBefore, insertAt)
parentNodeTarget!.insertBefore(insertBefore, insertAt)
} else {
this.adoptedInsertBefore = true
}
Expand Down Expand Up @@ -175,7 +176,7 @@ export class JsxObserver extends LifeCycle {
* - to the new array indexes for adds
* - sorted by index in ascending order
*/
observableArrayChange (changes) {
observableArrayChange (changes: KnockoutArrayChange<any>[]) {
let adds = []
let dels = []
for (const index in changes) {
Expand All @@ -196,12 +197,12 @@ export class JsxObserver extends LifeCycle {
* @param {int} index
* @param {string|object|Array|Observable.string|Observable.Array|Obseravble.object} jsx
*/
addChange (index, jsx) {
addChange (index: number, jsx: JsxNodeable) {
this.nodeArrayOrObservableAtIndex.splice(index, 0,
this.injectNode(jsx, this.lastNodeFor(index)))
}

injectNode (jsx, nextNode) {
injectNode (jsx: JsxNodeable, nextNode: Node) {
let nodeArrayOrObservable

if (isObservable(jsx)) {
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.js → tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compileOnSave": false,
"compilerOptions": {
"moduleResolution": "node",
"downlevelIteration": true,
"target": "ES3",
"module": "ES2015",
Expand All @@ -11,8 +12,12 @@
"strict": true,
"baseUrl": ".",
"paths": {
"@tko/*": [ "*/src" ],
"@tko/*": ["packages/*/src/index.js"],
"*": ["*"],
},
"traceResolution": true,
},
// "include": ["**/*.ts", "**/*.js", "packages/@types/index.d.ts"],
// "files": ["packages/*/src/index.js"],
// "exclude": ["karma.conf.js", "node_modules", "**/spec/*"],
}

0 comments on commit 371e820

Please sign in to comment.