diff --git a/Package.swift b/Package.swift index 61dfb92..62cdbca 100644 --- a/Package.swift +++ b/Package.swift @@ -26,9 +26,7 @@ let package = Package( .product(name: "SwiftTypeReader", package: "SwiftTypeReader"), .product(name: "TypeScriptAST", package: "TypeScriptAST") ], - swiftSettings: [ - .enableUpcomingFeature("BareSlashRegexLiterals"), - ] + swiftSettings: swiftSettings() ), .testTarget( name: "CodableToTypeScriptTests", @@ -39,3 +37,10 @@ let package = Package( ), ] ) + +func swiftSettings() -> [SwiftSetting] { + return [ + .enableUpcomingFeature("BareSlashRegexLiterals"), + .enableExperimentalFeature("StrictConcurrency") + ] +} diff --git a/Sources/CodableToTypeScript/Extensions/TSASTEx.swift b/Sources/CodableToTypeScript/Extensions/TSASTEx.swift index 15802fa..d68fadb 100644 --- a/Sources/CodableToTypeScript/Extensions/TSASTEx.swift +++ b/Sources/CodableToTypeScript/Extensions/TSASTEx.swift @@ -49,6 +49,6 @@ extension TSIdentType { } extension TSIdentExpr { - static let json = TSIdentExpr("json") - static let entity = TSIdentExpr("entity") + static var json: TSIdentExpr { TSIdentExpr("json") } + static var entity: TSIdentExpr { TSIdentExpr("entity") } } diff --git a/Sources/CodableToTypeScript/Value/CodecPresence.swift b/Sources/CodableToTypeScript/Value/CodecPresence.swift index 6d72c52..467d125 100644 --- a/Sources/CodableToTypeScript/Value/CodecPresence.swift +++ b/Sources/CodableToTypeScript/Value/CodecPresence.swift @@ -1,4 +1,4 @@ -public enum CodecPresence: Int, Comparable { +public enum CodecPresence: Int, Sendable & Hashable & Comparable { case identity = 0 case conditional = 1 case required = 2 diff --git a/Sources/CodableToTypeScript/Value/GenerationTarget.swift b/Sources/CodableToTypeScript/Value/GenerationTarget.swift index 5f158ee..4152cfa 100644 --- a/Sources/CodableToTypeScript/Value/GenerationTarget.swift +++ b/Sources/CodableToTypeScript/Value/GenerationTarget.swift @@ -1,4 +1,4 @@ -public enum GenerationTarget { +public enum GenerationTarget: Sendable & Hashable { case entity case json } diff --git a/Sources/CodableToTypeScript/Value/NamePath.swift b/Sources/CodableToTypeScript/Value/NamePath.swift index 69901c1..a0d2cf0 100644 --- a/Sources/CodableToTypeScript/Value/NamePath.swift +++ b/Sources/CodableToTypeScript/Value/NamePath.swift @@ -1,4 +1,4 @@ -struct NamePath { +struct NamePath: Sendable & Hashable { var items: [String] init(_ items: [String]) { diff --git a/Sources/CodableToTypeScript/Value/TSKeyword.swift b/Sources/CodableToTypeScript/Value/TSKeyword.swift index 765f988..ad0b98d 100644 --- a/Sources/CodableToTypeScript/Value/TSKeyword.swift +++ b/Sources/CodableToTypeScript/Value/TSKeyword.swift @@ -1,4 +1,4 @@ -enum TSKeyword: String { +enum TSKeyword: String, Sendable & Hashable { case `break` case `case` case `catch` diff --git a/Sources/CodableToTypeScript/Value/TypeMap.swift b/Sources/CodableToTypeScript/Value/TypeMap.swift index 5770ae9..6dd3065 100644 --- a/Sources/CodableToTypeScript/Value/TypeMap.swift +++ b/Sources/CodableToTypeScript/Value/TypeMap.swift @@ -1,7 +1,7 @@ import SwiftTypeReader -public struct TypeMap { - public struct Entry { +public struct TypeMap: Sendable { + public struct Entry: Sendable { public static func identity(name: String) -> Entry { return Entry( entityType: name, @@ -43,8 +43,8 @@ public struct TypeMap { } } - public typealias MapFunction = (any SType) -> Entry? - + public typealias MapFunction = @Sendable (any SType) -> Entry? + public static let `default` = TypeMap( table: TypeMap.defaultTable ) @@ -69,7 +69,7 @@ public struct TypeMap { ] public init( - table: [String : Entry]? = nil, + table: [String: Entry]? = nil, mapFunction: MapFunction? = nil ) { self.table = table ?? Self.defaultTable