kotools / types

Explicit types for Kotlin Multiplatform.
https://types.kotools.org
MIT License
90 stars 6 forks source link

✨ New public constructor for `NotBlankString` #625

Closed LVMVRQUXL closed 7 months ago

LVMVRQUXL commented 8 months ago

[!IMPORTANT] This is an incompatible source change. See our versioning strategy for more details on when we could publish it.

📝 Description

We want to introduce a public constructor in the NotBlankString type accepting a String value for replacing the create(Any?) and the createOrNull(Any?) functions from its companion object. For ensuring a smooth migration, we also want to deprecate these functions with an error level indicating that these will be removed in the next minor release. The deprecation should suggest an automatic replacement for using the new constructor.

// Actual
NotBlankString.create("Kotools Types") // pass
NotBlankString.createOrNull("Kotools Types") // pass

// Expected
NotBlankString("Kotools Types") // pass
NotBlankString.create("Kotools Types") // compilation error
NotBlankString.createOrNull("Kotools Types") // compilation error

✅ Checklist

LVMVRQUXL commented 7 months ago

The NotBlankString type will be reimplemented in #638.