Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -39,3 +37,10 @@ let package = Package(
),
]
)

func swiftSettings() -> [SwiftSetting] {
return [
.enableUpcomingFeature("BareSlashRegexLiterals"),
.enableExperimentalFeature("StrictConcurrency")
]
}
4 changes: 2 additions & 2 deletions Sources/CodableToTypeScript/Extensions/TSASTEx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ extension TSIdentType {
}

extension TSIdentExpr {
static let json = TSIdentExpr("json")
static let entity = TSIdentExpr("entity")
static var json: TSIdentExpr { TSIdentExpr("json") }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはキャッシュすることを諦めた

static var entity: TSIdentExpr { TSIdentExpr("entity") }
}
2 changes: 1 addition & 1 deletion Sources/CodableToTypeScript/Value/CodecPresence.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/CodableToTypeScript/Value/GenerationTarget.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public enum GenerationTarget {
public enum GenerationTarget: Sendable & Hashable {
case entity
case json
}
2 changes: 1 addition & 1 deletion Sources/CodableToTypeScript/Value/NamePath.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct NamePath {
struct NamePath: Sendable & Hashable {
var items: [String]

init(_ items: [String]) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/CodableToTypeScript/Value/TSKeyword.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum TSKeyword: String {
enum TSKeyword: String, Sendable & Hashable {
case `break`
case `case`
case `catch`
Expand Down
10 changes: 5 additions & 5 deletions Sources/CodableToTypeScript/Value/TypeMap.swift
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
)
Expand All @@ -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
Expand Down