Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tscpp opened this issue Nov 12, 2020 · 0 comments
Open

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

tscpp opened this issue Nov 12, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@tscpp
Copy link
Member

tscpp commented Nov 12, 2020

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
@tscpp tscpp added bug Something isn't working status: triage labels Nov 12, 2020
@maskmaster maskmaster changed the title If binding handler not defined type injection will fail If binding handler is not defined type, injection will fail Nov 12, 2020
@maskmaster maskmaster changed the title If binding handler is not defined type, injection will fail If binding handler is not defined, type injection will fail Nov 12, 2020
@tscpp tscpp modified the milestone: 0.0.1 - first release Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Triage
Development

No branches or pull requests

1 participant