Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

342
Vistas
How to configure Steep to find RBS files for a gem outside the stdlib?
Cannot find type `Sinatra::Base`

ruby file

class StaticApp < Sinatra::Base
end  

rbs file

class StaticApp < Sinatra::Base
end  

run

bundle exec steep check --log-level=fatal

result

[error] Cannot find type `Sinatra::Base`
Diagnostic ID: RBS::UnknownTypeName 

I use steep gem. It seems it is needed to require some files. But

library 'sinatra' 

doesn't work.

#<RBS::EnvironmentLoader::UnknownLibraryError: Cannot find type definitions for library: sinatra ([nil])>

What do I wrong? Thanks.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

But library 'sinatra' doesn't work .. RBS::EnvironmentLoader::UnknownLibraryError

Short answer

# Steepfile
target :app do
  repo_path 'vendor/rbs'

Create a directory structure like vendor/rbs/sinatra/0/sinatra.rbs.

How you write or generate the contents of sinatra.rbs is out of the scope of this answer, but check out gem_rbs_collection. Rails people, see rbs_rails.

Long answer

Steep is using an RBS::EnvironmentLoader.

# steep-0.47.0/lib/steep/project/target.rb:54
loader = RBS::EnvironmentLoader.new(core_root: core_root_path, repository: repo)
options.libraries.each do |lib|
  name, version = lib.split(/:/, 2)
  loader.add(library: name, version: version)
end

The EnvironmentLoader can find a library in either gem_sig_path (I think this would be a sig folder distributed in the gem), or in a repository.

# rbs-1.7.1/lib/rbs/environment_loader.rb:68
def has_library?(library:, version:)
  if self.class.gem_sig_path(library, version) || repository.lookup(library, version)
    true
  else
    false
  end
end

In a Steepfile, repositories are configured via repo_path.

# Steepfile
repo_path 'vendor/rbs'

For the directory structure of a repository, I took https://github.com/ruby/rbs/tree/master/stdlib as an example.

ls -R vendor/rbs
activesupport

vendor/rbs/activesupport:
0

vendor/rbs/activesupport/0:
activesupport.rbs
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda