Function isStrictCompilerOptionEnabled

  • Checks if a given compiler option is enabled, accounting for whether all flags (except strictPropertyInitialization) have been enabled by strict: true.

    Parameters

    Returns boolean

    Example

    const optionsLenient = {
    noImplicitAny: true,
    };

    isStrictCompilerOptionEnabled(optionsLenient, "noImplicitAny"); // true
    isStrictCompilerOptionEnabled(optionsLenient, "noImplicitThis"); // false

    Example

    const optionsStrict = {
    noImplicitThis: false,
    strict: true,
    };

    isStrictCompilerOptionEnabled(optionsStrict, "noImplicitAny"); // true
    isStrictCompilerOptionEnabled(optionsStrict, "noImplicitThis"); // false