From 8ccc2264103f88fd6a0f95af2a31692abe1455a9 Mon Sep 17 00:00:00 2001 From: Erik Gaal Date: Mon, 20 Dec 2021 17:34:36 +0100 Subject: [PATCH] fix: allow interfaces in default type replacements For example, we use the `Carbon\CarbonInterface` often, but we cannot set a default replacement for it now. --- src/TypeScriptTransformerConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TypeScriptTransformerConfig.php b/src/TypeScriptTransformerConfig.php index 311d750..0d0c763 100644 --- a/src/TypeScriptTransformerConfig.php +++ b/src/TypeScriptTransformerConfig.php @@ -137,7 +137,7 @@ public function getDefaultTypeReplacements(): array $replacements = []; foreach ($this->defaultTypeReplacements as $class => $replacement) { - if (! class_exists($class)) { + if (! class_exists($class) && ! interface_exists($class)) { throw InvalidDefaultTypeReplacer::classDoesNotExist($class); }