Skip to content
This repository was archived by the owner on Sep 18, 2026. It is now read-only.
This repository was archived by the owner on Sep 18, 2026. It is now read-only.

If binding handler is not defined, type injection will fail #74

Description

@tscpp

The child context should default to ChildBindingContext<unkown, unknown>. All of the referenced variables in the view exists in ViewModel. This will lead to all variables in child bindings not be defined.

<!-- ko-viewmodel: import default from './window' -->

<div class="window" data-bind="draggable: windowdrag">
	<div class="window--window-wrapper">

		<!-- ko if: showTitleBar -->
		<div class="window--title-bar">
			<div class="title" data-bind="text: title, drag: windowdrag"></div>
			<div class="controls">
				<button class="no-ui control control-hide">
					<img src="/icons/minimize.svg">
				</button>
				<button class="no-ui control maximize">
					<img src="/icons/maximize.svg">
				</button>
				<button class="no-ui control close">
					<img src="/icons/close.svg">
				</button>
			</div>
		</div>
		<!-- /ko -->

		<!-- ko if: component -->
		<div class="window--content" data-bind="component: { name: component, params: { windows: windows } }"></div>
		<!-- /ko -->

		<!-- ko if: !component && content -->
		<div class="window--content" data-bind="html: content"></div>
		<!-- /ko -->

		<span class="window--resize window--north"></span>
		<span class="window--resize window--south"></span>
		<span class="window--resize window--west"></span>
		<span class="window--resize window--east"></span>
		<span class="window--resize window--north-west window--corner"></span>
		<span class="window--resize window--north-east window--corner"></span>
		<span class="window--resize window--south-west window--corner"></span>
		<span class="window--resize window--south-east window--corner"></span>

	</div>
</div>
C:/Users/elias/Projects/tacos/client/components/window.html
  8:39  error    Cannot find name 'title'.  TS2304
  27:15  error    Cannot find name 'content'.  TS2304
  28:48  error    Cannot find name 'content'.  TS2304
  23:15  error    Cannot find name 'component'.  TS2304
  24:53  error    Cannot find name 'component'.  TS2304
  27:15  error    Cannot find name 'component'.  TS2304
  8:52  error    Cannot find name 'windowdrag'.  TS2304
  6:15  error    Cannot find name 'showTitleBar'.  TS2304
  24:53  error    Cannot find name 'windows'. Did you mean 'Window'?  TS2552
  8:46  error    Argument of type '"drag"' is not assignable to parameter of type '"visible" | "hidden" | "html" | "class" | "css" | "style" | "attr" | "text" | "event" | "click" | "submit" | "enable" | "disable" | "value" | "textInput" | "hasFocus" | "checked" | ... 11 more ... | "let"'.  TS2345   
  3:31  error    Argument of type '"draggable"' is not assignable to parameter of type '"visible" | "hidden" | "html" | "class" | "css" | "style" | "attr" | "text" | "event" | "click" | "submit" | "enable" | "disable" | "value" | "textInput" | "hasFocus" | "checked" | ... 11 more ... | "let"'.  TS2345

✖ 11 problem (11 errors, 0 warning)
/* eslint-disable */
import { RootBindingContext, StandardBindingContextTransforms, Overlay, BindingContextTransform } from 'C:/Users/elias/Projects/knockout-lint/knockout-lint/lib/context'
import ViewModel from './window'
function getBindingContextFactory<K extends keyof BindingContextTransforms>(bindingHandlerName: K) {
	void bindingHandlerName
	const factory: BindingContextTransforms[K] = 0 as any;
	return factory;
}
interface BindingContextTransforms extends Overlay<{

}, StandardBindingContextTransforms> { }

const root_context: RootBindingContext<ViewModel> = undefined as any

const getChildContext_1 = getBindingContextFactory('draggable') // <---- DRAGGABLE IS NOT DEFINED
const context_0 = getChildContext_1(binding_1(root_context), root_context)
const getChildContext_3 = getBindingContextFactory('if')
const context_2 = getChildContext_3(binding_5(context_0), context_0)
const getChildContext_5 = getBindingContextFactory('component')
const context_4 = getChildContext_5(binding_6(context_2), context_2)
const getChildContext_7 = getBindingContextFactory('if')
const context_6 = getChildContext_7(binding_7(context_0), context_0)
const getChildContext_9 = getBindingContextFactory('html')
const context_8 = getChildContext_9(binding_8(context_6), context_6)
const getChildContext_11 = getBindingContextFactory('if')
const context_10 = getChildContext_11(binding_2(context_0), context_0)
const getChildContext_13 = getBindingContextFactory('text')
const context_12 = getChildContext_13(binding_3(context_10), context_10)
const getChildContext_15 = getBindingContextFactory('drag')
const context_14 = getChildContext_15(binding_4(context_10), context_10)
function binding_1($context: typeof root_context) {
    const { $parents, $root, $data, $rawData } = $context
    {
        const { windows, title, content, windowdrag, component, showTitleBar } = $context.$data
        return windowdrag
    }
}
function binding_5($context: typeof context_0) {
    const {  } = $context
    {
        const {  } = $context.$data
        return component
    }
}
function binding_6($context: typeof context_2) {
    const {  } = $context
    {
        const {  } = $context.$data
        return { name: component, params: { windows: windows } }
    }
}
function binding_7($context: typeof context_0) {
    const {  } = $context
    {
        const {  } = $context.$data
        return !component && content
    }
}
function binding_8($context: typeof context_6) {
    const {  } = $context
    {
        const {  } = $context.$data
        return content
    }
}
function binding_2($context: typeof context_0) {
    const {  } = $context
    {
        const {  } = $context.$data
        return showTitleBar
    }
}
function binding_3($context: typeof context_10) {
    const {  } = $context
    {
        const {  } = $context.$data
        return title
    }
}
function binding_4($context: typeof context_10) {
    const {  } = $context
    {
        const {  } = $context.$data
        return windowdrag
    }
}
//@ sourceMappingURL=C:\Users\elias\Projects\tacos\client\components\window.html

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions