diff --git a/Sources/Codextended/Codextended.swift b/Sources/Codextended/Codextended.swift index 36efad0..f6e4a5f 100644 --- a/Sources/Codextended/Codextended.swift +++ b/Sources/Codextended/Codextended.swift @@ -81,7 +81,7 @@ public extension Data { /// If no explicit encoder is passed, then the data is decoded as JSON. func decoded(as type: T.Type = T.self, using decoder: AnyDecoder = JSONDecoder()) throws -> T { - return try decoder.decode(T.self, from: self) + return try decoder.decode(type, from: self) } }