docs: @CheckReturnValue
    protected Statement genParamTypeChecks(TemplateNode node, String alias) {
      ImmutableList.Builder<Statement> declarations = ImmutableList.builder();
      for (TemplateParam param : node.getAllParams()) {
        String paramName = param.name();
        SoyType paramType = param.type();
        CodeChunk.Generator generator = templateTranslationContext.codeGenerator();
        Expression paramChunk = genCodeForParamAccess(paramName, param);
        JsType jsType = getJsTypeForParamTypeCheck(paramType);
        // The opt_param.name value that will be type-tested.
        String paramAlias = genParamAlias(paramName);
        Expression coerced = jsType.getValueCoercion(paramChunk, generator);
        if (coerced != null) {
          // since we have coercion logic, dump into a temporary
          paramChunk = generator.declarationBuilder().setRhs(coerced).build().ref();
        }
        if (param.hasDefault()) {
          if (coerced == null) {
            paramChunk = generator.declarationBuilder().setRhs(paramChunk).build().ref();
          }
          declarations.add(
              genParamDefault(param, paramChunk, alias, jsType, /* declareStatic= */ true));
        }
        // The param value to assign
        Expression value;
        Optional<Expression> soyTypeAssertion =
            jsType.getSoyTypeAssertion(paramChunk, paramName, generator);
        // The type-cast expression.
        if (soyTypeAssertion.isPresent()) {
          value = soyTypeAssertion.get();
        } else {
          value = paramChunk;
        }
  
        VariableDeclaration.Builder declarationBuilder =
            VariableDeclaration.builder(paramAlias)
                .setRhs(value)
                .setGoogRequires(jsType.getGoogRequires());
        declarationBuilder.setJsDoc(
            JsDoc.builder()
                .addParameterizedAnnotation(
                    "type", getJsTypeForParamForDeclaration(paramType).typeExpr())
                .build());
        VariableDeclaration declaration = declarationBuilder.build();
        declarations.add(declaration);
  
        templateTranslationContext
            .soyToJsVariableMappings()
            // TODO(lukes): this should really be declartion.ref() but we cannot do that until
            // everything is on the code chunk api.
            .put(paramName, id(paramAlias));
      }
      return Statement.of(declarations.build());
    }