Pular para o conteúdo

noRestrictedTypes

Este conteúdo não está disponível em sua língua ainda.

Diagnostic Category: lint/nursery/noRestrictedTypes

Since: v1.9.0

Sources:

Disallow user defined types.

This rule allows you to specify type names that you don’t want to use in your application.

To prevent use of commonly misleading types, you can refer to noBannedTypes

Use the options to specify additional types that you want to restrict in your source code.

{
"//": "...",
"options": {
"types": {
"Foo": {
"message": "Only bar is allowed",
"use": "bar"
},
"OldAPI": "Use NewAPI instead"
}
}
}

In the example above, the rule will emit a diagnostics if Foo or OldAPI are used.