1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/// Options for type checking
/// TODO figure out compat with tsc
#[derive(serde::Deserialize)]
// TODO: Can be refactored with bit to reduce memory
#[allow(clippy::struct_excessive_bools)]
pub struct TypeCheckOptions {
	/// Parameters cannot be reassigned
	pub constant_parameters: bool,
	/// Missing arguments are treated as undefined (thats how JS works)
	pub allow_elided_arguments: bool,
	pub allow_extra_arguments: bool,
	pub constant_function_declarations: bool,
	/// Whether auto casts can happen
	/// TODO maybe levels
	pub strict_casts: bool,
	/// Any types displayed will be in debug view
	pub debug_types: bool,
}

impl Default for TypeCheckOptions {
	fn default() -> Self {
		Self {
			constant_parameters: false,
			allow_elided_arguments: false,
			allow_extra_arguments: false,
			constant_function_declarations: true,
			// TODO middle value
			strict_casts: false,
			debug_types: false,
		}
	}
}