type declarations
This commit is contained in:
parent bfbc8c3f7f
commit d197ddd8e7
4 changed files with 52 additions and 0 deletions
19 sig/lib/svelte.rbs Normal file
19
sig/lib/svelte.rbs Normal file | @ -0,0 +1,19 @@ | |||
type strict_hash = Hash[Symbol, String] | ||||
type flexi_hash = Hash[Symbol | String, String] | ||||
| ||||
module Svelte | ||||
self.@ssr: bool | ||||
self.@aliases: strict_hash | ||||
self.@preprocess: flexi_hash | ||||
| ||||
def self.ssr: -> bool | ||||
def self.aliases: -> strict_hash | ||||
def self.preprocess: -> flexi_hash | ||||
| ||||
def self.ssr=: (boolish) -> void | ||||
def self.aliases=: (strict_hash) -> void | ||||
def self.preprocess=: (flexi_hash) -> void | ||||
| ||||
def self.props: -> flexi_hash | ||||
def self.gem_dir: -> String | ||||
end |
21 sig/lib/svelte/errors.rbs Normal file
21
sig/lib/svelte/errors.rbs Normal file | @ -0,0 +1,21 @@ | |||
module Svelte | ||||
class CompilerError | ||||
# TODO: ActiveSupport::SyntaxErrorProxy is untyped, so this is an incomplete type definition | ||||
attr_accessor location: { file: String, line: Integer, lineText: String, suggestion: String? } | ||||
attr_accessor suggestion: String | ||||
attr_accessor template: ActionView::Template | ||||
attr_accessor message: String | ||||
| ||||
def initialize: (String, ActionView::Template) -> self | ||||
| ||||
def backtrace: -> Array[String] | ||||
def cause: -> nil | ||||
def binding: -> Array[Binding] | ||||
def backtrace_locations: -> Array[untyped] | ||||
def annotated_source_code: -> Array[String] | ||||
end | ||||
| ||||
class TemplateError | ||||
def initialize: () -> self | ||||
end | ||||
end |
6 sig/lib/svelte/handler.rbs Normal file
6
sig/lib/svelte/handler.rbs Normal file | @ -0,0 +1,6 @@ | |||
module Svelte | ||||
class Handler | ||||
def call: (ActionView::Template, String) -> String | ||||
def self.call: (ActionView::Template, String) -> String | ||||
end | ||||
end |
6 sig/lib/svelte/helpers.rbs Normal file
6
sig/lib/svelte/helpers.rbs Normal file | @ -0,0 +1,6 @@ | |||
module Svelte | ||||
module Helpers | ||||
include ActionView::Helpers | ||||
def svelte_tags: -> String | ||||
end | ||||
end |
Loading…
Add table
Add a link
Reference in a new issue