dojo / typings

Dojo 1 - TypeScript Typings (including Dijit and DojoX)
Other
28 stars 37 forks source link

Add type descriptor for module `dojo/i18n*` #152

Closed RoyTinker closed 4 years ago

RoyTinker commented 5 years ago

This adds a type dojo.I18nBundle and assigns that type to i18n bundles pulled in via dojo/i18n.

type I18nBundle = { [s: string]: string | I18nBundle };

When using it:

import i18n = require("dojo/i18n!./nls/Component");

//type of `i18n` is `dojo.I18nBundle`
RoyTinker commented 5 years ago

grunt test also fails on master with the same error.

rorticus commented 4 years ago

Ended up reverting this. After testing with the example apps, the recursive type makes it so this example,

@declare(DijitDialog)
class Dialog {
    title: string = messages.dialogTitle;
    content: string = messages.dialogContent;
}

had to be type-casted to,

@declare(DijitDialog)
class Dialog {
    title: string = messages.dialogTitle as string;
    content: string = messages.dialogContent as string;
}