DEV Community

hiko1129
hiko1129

Posted on • Originally published at note.hiko1129.com on

[Ruby][Sorbet] What to do when the RBI generated by tapioca does not have the expected type

Translate ja to en

sorbet/tapioca/require.rbを用意していない状態だと、Gemfileでrequire: falseとしているものやGem側がオプショナルなrequireとしているものなどは読み込まれず、RBIファイルには含まれないようです。
sorbet/tapioca/require.rbに読み込まれていないものを追加することでRBIファイルに型定義(というか雛形)が含まれる模様。

better_htmlのBetterHtml::Parserの型定義が必要にも関わらずRBIファイルに含まれていない場合には、sorbet/tapioca/require.rbに下記のようにbetter_html/parserを追加する必要があります(better_htmlはbetter_html/parserをデフォルトでは読み込まない)。

# typed: strict
# frozen_string_literal: true

require 'better_html/parser'
Enter fullscreen mode Exit fullscreen mode

参考

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️