Line an 8-inch square pan with parchment, leaving a little overhang for lifting.
Warm chocolate chips, condensed milk, butter, and salt in a medium saucepan over low heat.
Stir constantly until the mixture is smooth and glossy, 5–8 minutes. Remove from heat.
Stir in vanilla, then fold in walnuts if using.
Scrape the fudge into the prepared pan and smooth the top. Tap the pan to release air bubbles.
Chill until fully set, about 2 hours or until firm.
Lift out by the parchment and cut into small squares.