Skip to content

Commit 3cfafe0

Browse files
committed
Check API return objects against generic type
1 parent 47232ac commit 3cfafe0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/ComposableArchitecturePattern/Server+API.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public protocol ServerAPI: Identifiable, Equatable {
4848
func request(_ method: HTTPMethod, at endpoint: String?, in environment: ServerEnvironment?, additionalHeaders: [String: String]?, additionalQueries: [URLQueryItem]?, httpBodyOverride httpBody: Data?, timeoutInterval: TimeInterval?) throws -> URLRequest
4949

5050
/// Whether or not the provided type is supported by the API. Defaults to checking if the type is found in `supportedReturnObjects` or returning `false` if not found.
51-
func supports<T: Decodable>(_ object: T.Type) -> Bool
51+
func supports<T>(_ object: T.Type) -> Bool
5252
}
5353

5454
extension Sequence where Element == Decodable.Type {
@@ -99,7 +99,7 @@ public extension ServerAPI {
9999

100100
var strictEnvironmentEnforcement: Bool { true }
101101

102-
func supports<T: Decodable>(_ object: T.Type) -> Bool {
102+
func supports<T>(_ object: T.Type) -> Bool {
103103
return self.supportedReturnObjects?.contains(where: { object == $0 }) ?? false
104104
}
105105
}

0 commit comments

Comments
 (0)