[TIMOB-26276] TypeScript: Add dict types for create factory functions
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Tooling |
| Labels | n/a |
| Reporter | Jan Vennemann |
| Assignee | Jan Vennemann |
| Created | 2018-08-08T11:41:50.000+0000 |
| Updated | 2019-11-19T11:59:29.000+0000 |
Description
Improve creation dict typings for create factory functions. This is currently set to
any but we could create a dictionary of available properties with [Distributive conditional types](http://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types)
These definitions from [typescript-alloy-app](https://github.com/appcelerator/titanium-boilerplates/blob/master/templates/typescript-alloy-app/app/globals.d.ts) could be moved to the main @types/titanium
-Or shorter version:- -type Dictionarytype NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T]; type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>; type Dictionary<T> = Partial<NonFunctionProperties<T>>;https://github.com/appcelerator/docs-devkit/pull/8