mithril.d.ts icon indicating copy to clipboard operation
mithril.d.ts copied to clipboard

Intellisense issue with non-nullable properties

Open vrimar opened this issue 8 years ago • 2 comments

Given this example:

interface IComponentAttrs {
	test: number;
}

class Component implements m.ClassComponent<IComponentAttrs> {
	view({ attrs }: m.CVnode<IComponentAttrs>) {
		return m('');
	}
}

class Page {
	view() {
		return m(Component, {
			// <== Not getting intellisense here
		});
	}
}

The test property (along with lifcycle attrs) aren't showing up under the intellisense in Vscode.

Here's my tsconfig.json:

{
	"compilerOptions": {
		"allowJs": true,
		"allowSyntheticDefaultImports": true,
		"importHelpers": true,
		"lib": [
			"dom",
			"es7"
		],
		"module": "commonjs",
		"sourceMap": false,
		"target": "es5",
		"typeRoots": [
			"node_modules/@types"
		]
	},
	"exclude": [
		"node_modules"
	]
}

If I set test to nullable it shows up fine (along with lifecycle attrs). Any insight on this?

vrimar avatar Jul 04 '17 22:07 vrimar

Interesting that it shows up when nullable. To be honest I've never been sure why intellisense doesn't work for attrs, I assumed it had to do with the complexity of the hyperscript signature. I won't have a lot of time to look into this for a while unfortunately.

I'll leave this issue open if anyone else has any insights.

spacejack avatar Jul 05 '17 20:07 spacejack

Interesting. I have filled a similar issue at VSCode https://github.com/Microsoft/vscode/issues/30709 but I am not sure if the problem is with VSCode or Typescript.

oldrich-s avatar Jul 14 '17 19:07 oldrich-s