From 6b561273481bfe6adc96c9f048e9f02edcc25cb7 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Sun, 24 Dec 2023 13:55:23 +0800 Subject: [PATCH] fixes #189 - `export` feature take proper path --- src/export/ts.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/export/ts.rs b/src/export/ts.rs index 4ed7ad9..1b99cef 100644 --- a/src/export/ts.rs +++ b/src/export/ts.rs @@ -1,4 +1,4 @@ -use std::collections::BTreeMap; +use std::{collections::BTreeMap, path::Path}; use crate::{ ts::{self, ExportConfig, ExportError}, @@ -8,12 +8,12 @@ use crate::{ use super::get_types; /// Exports all types in the [`TYPES`](static@crate::export::TYPES) map to the provided TypeScript file. -pub fn ts(path: &str) -> Result<(), ExportError> { +pub fn ts>(path: P) -> Result<(), ExportError> { ts_with_cfg(path, &ExportConfig::default()) } /// Exports all types in the [`TYPES`](static@crate::export::TYPES) map to the provided TypeScript file but allow you to provide a configuration for the exporter. -pub fn ts_with_cfg(path: &str, conf: &ExportConfig) -> Result<(), ExportError> { +pub fn ts_with_cfg>(path: P, conf: &ExportConfig) -> Result<(), ExportError> { let mut out = "// This file has been generated by Specta. DO NOT EDIT.\n\n".to_string(); // We sort by name to detect duplicate types BUT also to ensure the output is deterministic. The SID can change between builds so is not suitable for this.