Skip to content

Generation Options

Pavel Vostretsov edited this page May 9, 2023 · 1 revision

LinterDisableMode

Use /* eslint-disable */ or // tslint:disable comment in generated files. EsLint is default option.

EnableOptionalProperties

This option is enabled by default. When enabled produces optional properties for members which may contain nulls.

export type SomeType = {
    somePropertyWithNullableValue?: typeDefinition;
    somePropertyWithNonNullableValue: typeDefinition;
};

When disabled, all properties produced as required.

UseGlobalNullable

This option is disabled by default. When enabled, global Nullable<T> is used instead of union null | T

NullabilityMode

NullabilityMode has 4 options:

  • None - all generated properties are not null
  • Pessimistic (default) - generates Nullable property for properties that have no JetBrains nullability attributes
  • Optimistic - generates not null property for properties that have no JetBrains nullability attributes
  • NullableReference - generates not null properties based on C# 8 Nullable Reference Type attributes

Options Pessimistic or Optimistic can be combined with NullableReference option, this way generator first looks for C# 8 Nullable Reference Type attributes, then JetBrains nullability attributes

CustomContentMarker

Generated content marker to use instead of default // TypeScriptContractGenerator's generated content that is present in all generated files

Clone this wiki locally